-
Notifications
You must be signed in to change notification settings - Fork 90
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
"Extension" : channels for Real-time API backend. #205
Comments
ndrean
changed the title
"Deviation" : channels for Real-time API backend.
"Extension" : channels for Real-time API backend.
Oct 9, 2023
@ndrean thanks as always for sharing interesting things. ❤️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This video is interesting. It explains how you can build - mimic - a Phoenix REST API backend using WS-Channels (stateful) .
Instead of running a one shot HTTP requests (eg the client makes a
fetch
in JS to the Phoenix API endpoints), the client will establish a websocket, and run achannel.push("endpoint:event", msg)
. Thanks to pattern matching, the server handles this in somehandle_in("endpoint:event", data, socket)
and canbroadcast
back a response. Thanks to pattern matching, we have a correct routing of the action. This imitates a REST api but the connection is bi-directional, "pseudo-real-time" and stateful.The story around the parsing is not completely clear.
This guy wrote this package channel_handler. To try!
https://www.youtube.com/watch?v=ZBG9VXTycpI
The text was updated successfully, but these errors were encountered: