theturtle32 / WebSocket-Node

A WebSocket Implementation for Node.JS (Draft -08 through the final RFC 6455)
Apache License 2.0
3.73k stars 604 forks source link

multi sub protocol #387

Open SabinoSisto opened 4 years ago

SabinoSisto commented 4 years ago

this is my client call:

var client = new W3CWebSocket('ws://localhost:8080/TEST', ['ocpp1.6','ocpp1.5']);

into server side: var connection = request.accept(['ocpp1.6','ocpp1.5'], request.origin);

error: TypeError: acceptedProtocol.toLocaleLowerCase is not a function at WebSocketRequest.accept (c:\Personale\Siti\eRiparto\node_modules\websocket\lib\WebSocketRequest.js:257:70) at WebSocketServer. (c:\Personale\Siti\eRiparto\app.js:53:30) at WebSocketServer.emit (events.js:314:20) at WebSocketServer.handleUpgrade (c:\Personale\Siti\eRiparto\node_modules\websocket\lib\WebSocketServer.js:217:14) at Server.emit (events.js:314:20) at onParserExecuteCommon (_http_server.js:640:14) at onParserExecute (_http_server.js:573:3) at HTTPParser.callbackTrampoline (internal/async_hooks.js:123:14)

ibc commented 4 years ago

Why are you passing an array of strings instead of a single string? Where did you read that in the docs?

SabinoSisto commented 4 years ago

i want accept protocol ocpp1.6 or ocpp1.5 in server side how must define?

SabinoSisto commented 4 years ago

in client i change : var client = new W3CWebSocket('ws://localhost:8080/PROVA', 'ocpp1.6');

in server i changed: var connection = request.accept('ocpp1.6,ocpp1.5', request.origin);

this is new error: Error: Illegal character " " in subprotocol.

SabinoSisto commented 3 years ago

News for me?

SabinoSisto commented 3 years ago

i must accept protocol ocpp1.6 OR ocpp1.5 can you send me code to connection? Thank's