-
Notifications
You must be signed in to change notification settings - Fork 45
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 subscription #58
Comments
You can checkout the source code of
You don't really need Elm's subscription because BuckleScript make it really easily to enqueue a message when a callback of JavaScript is called. If you want to do it you can check out the source of |
@OvermindDL1 maybe we should add an example for this in README? It is definitely a good point to sell comparing to original Elm. |
Very true, websockets will be significantly easier to pull off in TEA than Elm. I'll leave this open until I (or a PR) gets to it. :-) But yeah, making new subscriptions and commands both are really easy in TEA unlike in Elm (where you cannot make new ones without an effect manager, which is highly limited as well). :-) |
Also, for note, the |
I have some examples with phoenix websockets that I could clean up a bit.
What are we looking for exactly?
…On Wed, 1 Nov 2017, 15:40 OvermindDL1, ***@***.***> wrote:
Also, for note, the !callbacks.enqueue is equivalent to Elm's Router
concept, just via a typed function call instead of a full unique type. :-)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#58 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACx6gC9bAvYmOXnAvPLNlqbBIw8XmZcks5syILKgaJpZM4QNT_J>
.
|
Probably need a websocket subscription manager written overall. Should not be too hard, I can do it when I get time again (so mid-late November for me), but if you want to do it feel free too. :-) |
Precisely. :-) It is still usually good form, but absolutely not required. :-) You don't really need the Cmd in your on_message as it is not doing anything for note. :-) |
I'm going to leave this open until I do get a subscription manager set up for it though, to remind me. :-) |
I thought the previous attempt of using I was also looking into So does anyone have an idea on how to manually trigger an update ? |
You have to return the results of that in the return of the update callback for it to be executed.
Ditto, needs to be returned in a command. Remember, only immutable things should happen inside all callbacks. Any 'actions' must be returned so the runtime system can execute them. |
The following statement successfully sets up a connection to a websocket server
How can bs-tea easily subscribe to on_message ?
Could we just manually trigger an update in
on_message
by using some internal function inVdom.ml
?I do understand that such an approach might be fundamentally different from traditional TEA ---
However said approach is more logically sensible to me and allows for much more fine-grained tuning & control over the server
The text was updated successfully, but these errors were encountered: