diff --git a/test-server/test-server.c b/test-server/test-server.c index 1a1cfb6f..1ab6fd2c 100644 --- a/test-server/test-server.c +++ b/test-server/test-server.c @@ -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; diff --git a/test-server/test.html b/test-server/test.html index 57e335ea..19c6218b 100644 --- a/test-server/test.html +++ b/test-server/test.html @@ -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('
Socket Status: '+socket.readyState);