Open gabridego opened 1 year ago
Hi, thank you for the detailed issue. I haven't met problems so far, so I cannot share any meaningful configuration.
I will try to debug it but no idea will I find something or not.
Hi, thank you for your quick reply! I can reproduce the issue with a very minimal example:
package main
import (
"net/http"
"github.com/gobwas/ws"
"github.com/gobwas/ws/wsutil"
)
func main() {
http.ListenAndServe(":9090", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
conn, _, _, _ := ws.UpgradeHTTP(r, w)
defer conn.Close()
wsutil.WriteServerText(conn, []byte("ciao"))
}))
}
On Safari console:
ws = new WebSocket("ws://127.0.0.1:9090")
ws.onmessage = (msg) => console.log(msg.data)
With NSURLSession WebSocket
enabled, it prints ciao and then gives the error. With the function disabled, just the message with no error.
Am I doing anything wrong? Thanks!
More discussion about this with possible workarounds in https://github.com/uNetworking/uWebSockets/issues/1347. As per the thread only "Safari 15.0-15.3" is affected and looks like 15.4 onwards works fine
Some workarounds discussed there are,
If anybody gets to test any of these workarounds, please report here
The example shown by @gabridego does not use compression. Also, I tested it on Safari 16.1 - and the error is still there. So I think those are two different Safari problems.
I am developing a WebRTC service which uses your library for the signalling phase. Everything works well on Chrome, Firefox and Android, but I am experiencing an error on Safari (macOS Ventura 13.3) and iOS:
[Error] WebSocket connection to 'wss://myapp.com/ws' failed: The operation couldn’t be completed. Socket is not connected
Anyway, it works on Safari when disabling the experimental feature 'NSURLSession WebSocket', which makes me suspect of a possible issue with WebSocket compression. Some related issues:
Is there any configuration I can use to make my websocket application work on Safari and iOS as well? Thank you!