syumai / workers

Go package to run an HTTP server on Cloudflare Workers.
MIT License
642 stars 39 forks source link

Websocket support #97

Open haorendashu opened 5 months ago

haorendashu commented 5 months ago

Using package github.com/gorilla/websocket to server websocket connection. When call upgrader.Upgrade(w, r, nil), it return an error:

2024/04/10 21:16:42 failed to upgrade websocket: websocket: response does not implement http.Hijacker

It seems that the response need to implement http.Hijacker interface.

syumai commented 5 months ago

This library is using JS API directly, so it's hard to provide http.Hijacker interface for Conn. But WebSocket support can be implemented using Durable Object, so I want to try another approach (without providing http.Hijacker). Thank you for submitting this issue!