[Libwebsockets] Unable to communicate with node server over Websocket

Andy Green andy at warmcat.com
Tue Aug 5 11:59:13 CEST 2014



On 5 August 2014 17:26:45 GMT+08:00, sthustfo <sthustfo at gmail.com> wrote:
>Hi All,
>
>I am new to libwebsockets and have started playing around recently. I
>am
>trying to use libwebsockets to connect to a node.js server that makes
>use
>of socket.io. When I try to connect the sample libwebrtc clent to the
>node
>server on local machine, the client terminates saying "WARN: problems
>parsing header".
>
>From wireshark, I can see the initial HTTP packet (with 'Upgrade'
>header)
>being sent to the node server but after that I do not see any packets
>being
>exchanged. The console log from the client is as below.
>
>test at devpc:~/libwebsockets/build/bin$ ./libwebsockets-test-client
>127.0.0.1
>--port=8888

Turn up the logging with -d 1023 or so

>libwebsockets test client
>(C) Copyright 2010-2013 Andy Green <andy at warmcat.com> licensed under
>LGPL2.1
>[1457:9886] NOTICE: Initial logging level 7
>[1457:9886] NOTICE: Library version: 1.3 67f9459
>[1457:9887] NOTICE: IPV6 compiled in and enabled
>[1457:9887] NOTICE: libev support not compiled in
>[1457:9889] NOTICE:  static allocation: 4472 + (12 x 1024 fds) = 16760
>bytes
>[1457:9890] NOTICE:  canonical_hostname = pk-laptop
>[1457:9890] NOTICE:  per-conn mem: 128 + 1594 headers + protocol rx buf
>Waiting for connect...
>[1457:9932] WARN: problems parsing header
>Exiting
>[1457:9933] NOTICE: libwebsocket_context_destroy
>
>And on the node server, I see the following log
>
>test at devpc:~/node$ DEBUG=* node basic.js
>   info  - socket.io started
>   debug - destroying non-socket.io upgrade
>   debug - destroying non-socket.io upgrade

Is socket.io compliant with the actual websockets standard or some older RFC?

It seems it can't parse our upgrade request (which does pretty good at being compliant with everything else).

-Andy

>The basic node server is below.
>
>var io = require('socket.io').listen(8888);
>
>io.configure('development', function() {
>  io.set('log level', 3);
>  io.set('transports', ['websocket']);
>});
>
>io.configure('production', function() {
>  io.set('transports', ['websocket']);
>});
>
>
>Could you please provide any pointers on why the communication is
>failing?
>Am I missing anything?
>
>Thanks.
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list