kataras / neffos

A modern, fast and scalable websocket framework with elegant API written in Go
http://bit.ly/neffos-wiki
MIT License
574 stars 49 forks source link

websocket Issue #44

Open yunxiangtc opened 4 years ago

yunxiangtc commented 4 years ago

Great writer kataras :

In the demo given by websocket, the ws open link starts with "http://xxx", and then connect in the way of Upgrade! ! Now the project needs to be compatible with the mobile app and needs the "ws://xxx" style. How can I change it? please help me

kataras commented 4 years ago

Hello @yunxiangtc, could you please give me more information, I didn't get it, code always speaks by itself, show me what you want from iris/neffos to do.

mikepony commented 4 years ago

iris-demo use websocket like this:”http://local host:80/api” send connect, but in my project need: ws://local host:80/api, and need reuseport,help me ,please!

kataras commented 4 years ago

@mikepony , examples uses ws:// to connect https://github.com/kataras/neffos/blob/15e3a17ca8e37b9e793fd59811e7fb42a30ac5ee/_examples/basic/browser/app.js#L3 Let me explain, you will always need to register a route on your http web server, the websocket protocol is a sub-protocol of http. You connect through ws:// (or wss:// in tls mode) but the request first fires as http, then server replies with an upgrade response and asks the client to continue the communication using websocket.

Please show me a code snippet of your problem so I can be more helpful.

Thanks, Gerasimos Maropoulos