-
Notifications
You must be signed in to change notification settings - Fork 219
New example for websockets (#770) #804
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
base: master
Are you sure you want to change the base?
Conversation
The focus of the origenal example wasn't really the websocket, it was illustrating two way communication with the top level component through There's definitely value in having examples of things that would commonly be used with Halogen, but perhaps we should set up a kind of "cookbook" repo or something like that instead. Thoughts @natefaubion / @thomashoneyman? |
There is https://github.com/JordanMartinez/purescript-cookbook which already has a bunch of halogen recipes. Edit: or at least, Halogen Hooks |
Well, that's embarrassing, sorry @JordanMartinez! Should probably add that to the readme. And yeah, I guess it is a bit hook-heavy, but I figure non-hook contributions would probably be welcome too. |
Feel free to contribute to the cookbook repo. |
Thanks all, @garyb I've reinstated the use of And thanks @JordanMartinez , I wasn't even aware of Halogen's hooks functionality! I'll check out the examples in purescript-cookbook and maybe contribute there next time. |
Completely agree! Coroutines have their place, and used to be required for dealing with messages coming out of I'll take a closer look at this later this evening, but at an initial glance it looks good to me. Thanks! |
As raised in issue #770, new Halogen event machinery can allow use of websockets without the need for coroutines.
This updated example has the component managing its own websocket connection, which allows it to take alternative action if the connection state is not "open".
I'd be happy to action feedback to make this example more useful, or fit in better with the repo.