[Libwebsockets] Problem with using multiple sub-protocols

sunny s sunny46916 at gmail.com
Tue Jun 30 07:31:36 CEST 2015

Hi all,

We are trying to use libwebsocket first time to setup a communication
between a C application and a C#.NET based windows service.

We need to use multiple sub protocols with websocket in our application.
But we are facing some issue.
Looks like it always uses 0th indexed protocol only.

Web socket server developed in C#.NET.
Web socket client developed in C.

Sample code:
static struct libwebsocket_protocols protocols[] = {

We tried to connect web socket client with server by using 1st index
(dumb-proto-A) and it worked successfully.
API used  for connect was libwebsocket_client_connect
(context,ServerIP,port, 0, ServerService, ServerIP, ServerIP,
protocols[1].name, -1).

However, we observed that after connection is established with server,
library always triggers callback of 0th indexed protocol. When we try
connecting using "dumb-proto-B" it fails to connect and instead calls a
callback "dumb-proto-A".

Due to above limitation, we are able to use only single protocol in our
application. We have taken reference of test-client.c from libwebsocket
sources for our implementation.

Is there any flag or something that needs to be enabled to use a
sub-protocol with an index other than zero.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20150630/fb633bbb/attachment.html>

More information about the Libwebsockets mailing list