When I create a new WebSocket it sends a request w...
# workers-help
t
why?
should it not have the "upgrade" header
d
The way websockets work is by first sending a http GET request to the provided endpoint, which can then be upgraded by the server if the
upgrade: websocket
header is sent - along with some other websocket-related headers
t
so how might i handle that on the server side?
not asking for code just a description if possible
d
well in a worker, you need to tell the runtime to create a websocket connection, terminate one side within the runtime and send back the other one to the client
t
actually i think i might need some code
im a bit lost
d
take a look at the tutorial I linked above, it has a complete example
t
yeah i tried implementing that but it didnt like it
it says that it has an invalid upgrade header
the upgrade header is just websocket though
@Dani Foldi ?
n
@thatbeanlady here's a working example of something I started putting together a while back but stopped: https://github.com/nora-soderlund/CortexGameService
t
thank you