-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket example error #5
Comments
Hi, what clients are you using? Could you try this script in browser: const socket = new WebSocket('ws://127.0.0.1:8000/chat')
socket.addEventListener('open', function (event) {
socket.send('Hello Server!')
})
socket.addEventListener('message', function (event) {
console.log('Message from server ', event.data)
}) |
When I run that script from codepen.io in firefox it returns in the console:
and the server in the terminal returns:
but simply requesting 127.0.0.1:8000/chat in firefox returns in the terminal running the server
Behavior is the same in chromium. using the URL
though this is inconsistent. |
It seems the socket is closed by codepen after establishing connection. Browser cannot handle websocket protocol straightly, you should open a web console in any website without security policy. Could you follow below steps to test websocket example?
|
Yes that seems to work, thanks. Is that the expected way for someone to use that example? |
Yeah, it is. Could I close this issue if there is no problem else? |
not able to run the websocket example. Requesting
ws://127.0.0.1:8000/chat
results inThe text was updated successfully, but these errors were encountered: