[asterisk-dev] Asterisk with socket.io

Dan Jenkins dan.jenkins88 at gmail.com
Wed Jan 21 09:23:36 CST 2015


On Wed, Jan 21, 2015 at 2:36 AM, Vipul Rastogi <vipul.rastogi at temasys.com.sg
> wrote:

> Anybody tried asterisk connecting to Socket.io server as websocket client
> ? I am not getting websocket established.
>
> See below error, after successful 101 Switching Protocols
>
> res_http_websocket.c:576 __ast_websocket_read: WebSocket unknown opcode 5
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev


Hi Vipul,

Socket.io won't work with the websocket module in Asterisk as Socket.io is
a layer on top of websockets/xhr polling/flash sockets.

Socket.io actually makes HTTP requests to the host you're trying to connect
to and the host needs to understand the "socket.io protocol" as such, this
sets up a socket.io session, gives back a list of available transports etc,
then with that response, the client sends a websocket request (or whatever
transport you select) with the socket.io sessionId etc.

So you can see why the normal websocket module in Asterisk can't deal with
this. You would need a socket.io module in Asterisk, which does exist, the
Respoke team use socket.io and so our Respoke channel driver uses the
socket.io transport -
https://github.com/respoke/chan_respoke/blob/master/include/asterisk/res_socket_io.h,
this module is released under GPLv2 Licensing.

Hope this helps you

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150121/c14f41b8/attachment.html>


More information about the asterisk-dev mailing list