Closed lucaele closed 5 years ago
Fix it!
1) Add this line to Pusher.php: use Ratchet\WebSocket\WsServerInterface;
2) upgrade line definition Class like this: class Pusher implements WampServerInterface, WsServerInterface ....
3) Add this inside of Pusher Class: public function getSubProtocols() { return ['ocpp1.6']; }
Thanks, this helped me also with the same issue. Good luck with the development of your EV charger central server, that's what the OCPP protocol is used for.
Hello, thanks for your work. I am trying to use Ratchet for the first time. I has followed the "Push integration" tuto on the ratchet website. And I have the same issue, I apply the solution from lucaele, but Firefox return the error code 426, and it doesn't establish the connection with the websocket. While, the header "Sec-WebSocket-Protocol" has this value: "ocpp1.6, wamp". Could you tell me what is going wrong ?
@Wyyllys This code means the server is expecting one of two sub-protocols but neither were provided. Where is your client connecting code?
Hello, thanks for your reply.
The client is a firefox browser, here is the js code for establish the connection:
var conn = new WebSocket('ws://192.168.1.156:8080'); conn.onopen = function(e) { console.log("Connection established!"); };
Do I need to specify the protocol for the websocket instance?
Do I need to specify the protocol for the websocket instance?
Yes, since you have configured your server to require either "ocpp1.6" or "wamp". See the browser WebSocket API
Yes, it is working, Thanks a lot, now I can move on ;-) !
Hi all, using "Push" example i have Status Code error 426. I don't know how set one protocol on response header. Any idea? Thanks
Request Header GET ws://:/ocpp/BTC1 HTTP/1.1
Host: :
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: file://
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en;q=0.8
Sec-WebSocket-Key: KET8SE4BEUe9VF+JnuctiA==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Protocol: ocpp1.6, ocpp1.5
Response Header HTTP/1.1 426 No Sec-WebSocket-Protocols requested supported Connection: Upgrade Upgrade: websocket Sec-WebSocket-Version: 13 Sec-WebSocket-Protocol: 0 X-Powered-By: Ratchet/0.4.1