Comments (6)
Just to confirm on the note about Cowboy, it does automatically close the websocket if a :close
reply is sent.
from websock_adapter.
Just to confirm on the note about Cowboy, it does automatically close the websocket if a
:close
reply is sent.
I just found explicit validation of this in Cowboy's documentation at the very bottom of https://ninenines.eu/docs/en/cowboy/2.6/guide/ws_handlers/
from websock_adapter.
I was just looking at phoenixframework/phoenix#5024!
I deliberately didn't accommodate sending close frames in WebSock because I didn't see a clear way to expose it, but now that the dust has settled I think I see a way forward that's really easy to land:
- Add a clauses to
t:WebSock.handle_result
that looks like{:stop, reason, code | {code, message}, state}
- Support this in
WebSockAdapter.CowboyAdapter.handle_reply
(I'm unclear whether Cowboy will automatically close the connection if you return a{:reply, {:close...}, state}
tuple; otherwise we'd need to get fancy here with messaging ourselves or the like). - Support this in Bandit by adding a clause to
Bandit.WebSocket.Connection.handle_continuation
very much like the existing{:stop,....}
tuple, making sure that the semantics are consistent with those of Cowboy - Document whatever those semantics are in WebSock (so long as these semantics are reasonable and consistent between implementations I'm sure they're fine).
Happy to accept PRs for this! I'd suspect it to be three PRs, one each for websock, websock_adapter, and bandit.
from websock_adapter.
This functionality is ready for review on Cowboy at the PRs linked above.
Next step is to get the websock PR reviewed & landed.
Once that's done, I'll cut a websock release and update the websock_adapter PR and Bandit PR to point at it.
from websock_adapter.
Awesome!
from websock_adapter.
All work for this is done & merged. This will now work for websock_adapter >= 0.5.0
. You can update this dependency locally within any recent phoenix app & have access as needed.
from websock_adapter.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websock_adapter.