require-specific-test-protocol.patch

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2010-11-11 12:52:28 +00:00
parent ce510c6beb
commit 462bbf711e
2 changed files with 9 additions and 5 deletions

View file

@ -164,12 +164,16 @@ static int websocket_callback(struct libwebsocket * wsi,
case LWS_CALLBACK_PROTOCOL_FILTER:
if (in == NULL) {
fprintf(stderr, "Client did not request protocol\n");
/* accept it */
return 0;
/* reject it */
return 1;
}
fprintf(stderr, "Client requested protocol '%s'\n", in);
/* accept it */
return 0;
if (strcmp(in, "dumb-increment-protocol") == 0)
/* accept it */
return 0;
/* reject the connection */
return 1;
}
return 0;

View file

@ -20,7 +20,7 @@
else
websocket_ads = "ws://127.0.0.1:7681"
var socket = new WebSocket(websocket_ads);
var socket = new WebSocket(websocket_ads, "dumb-increment-protocol");
try {
// alert('<p class="event">Socket Status: '+socket.readyState);