Quick question. I want to implement the ocpp protocol version 1.6j in Phoenix using WebSockets.
Now in specification, it is stated that:
Upon receiving the Charge Point’s request, the Central System has to finish the handshake with a
response as described in [RFC6455].
The following OCPP-J-specific conditions apply:
• If the Central System does not recognize the charge point identifier in the URL path, it SHOULD
send an HTTP response with status 404 and abort the WebSocket connection as described in
[RFC6455].
• If the Central System does not agree to using one of the subprotocols offered by the client, it MUST
complete the WebSocket handshake with a response without a Sec-WebSocket-Protocol header and
then immediately close the WebSocket connection.
So if the Central System accepts the above example request and agrees to using OCPP 1.6J with the
Charge Point, the Central System’s response will look as follows:
The bold parts are found as such in every WebSocket handshake response, the other parts are specific
to this example.
The role of the Sec-WebSocket-Accept header is explained in [RFC6455].
The Sec-WebSocket-Protocol header indicates that the server will be using OCPP1.6J on this connection.
So basically I need to set in the reply a specific header, mainly "sec-websocket-protocol": "ocpp1.6"
Since Websock
Here is my implementation:
defmodule MyApp.WebSocketController do
alias MyApp.Websocket.Ocpp.ProtocolHandler
use MyApp, :controller
@timeout 60_000
def websocket(conn, params) do
conn
|> put_resp_header("sec-websocket-protocol", "ocpp1.6")
|> WebSockAdapter.upgrade(
ProtocolHandler,
params,
timeout: @timeout
)
end
end
Hey, Mat.
Quick question. I want to implement the ocpp protocol version 1.6j in Phoenix using WebSockets.
Now in specification, it is stated that:
Upon receiving the Charge Point’s request, the Central System has to finish the handshake with a response as described in [RFC6455]. The following OCPP-J-specific conditions apply: • If the Central System does not recognize the charge point identifier in the URL path, it SHOULD send an HTTP response with status 404 and abort the WebSocket connection as described in [RFC6455]. • If the Central System does not agree to using one of the subprotocols offered by the client, it MUST complete the WebSocket handshake with a response without a Sec-WebSocket-Protocol header and then immediately close the WebSocket connection. So if the Central System accepts the above example request and agrees to using OCPP 1.6J with the Charge Point, the Central System’s response will look as follows:
The bold parts are found as such in every WebSocket handshake response, the other parts are specific to this example. The role of the Sec-WebSocket-Accept header is explained in [RFC6455]. The Sec-WebSocket-Protocol header indicates that the server will be using OCPP1.6J on this connection.
So basically I need to set in the reply a specific header, mainly
"sec-websocket-protocol": "ocpp1.6"
Since WebsockHere is my implementation:
Upon reviewing the response, this is what I get
I wonder what am I missing. I believe there should be a better way of injecting the headers Thanks