Re: Hitting an API with Euphoria
- Posted by jimcbrown (admin) Dec 22, 2017
- 1844 views
Node.js has async functionality, so it's nice to use it to hit an API websocket and grab data while other processes continue.
Cool.
Euphoria has HTTP support, but not WebSockets. Doesn't look too hard to add, though: https://en.wikipedia.org/wiki/WebSocket
I'm curious, could Euphoria be used to pull data from a web socket, keeping maybe a sequence populated with the latest data, while another part of the code utilizes that data?
Yes, the easiest way will be to use tasks.
Node.js has async/await, but is that really necessary for what I want to do?
If you need to do other things while waiting on the data, then you will need nonblocking/async sockets. It's not necessary if you are ok with blocking waits (but few are). Even with tasks, a blocking call will cause all tasks to wait.
True multithreading would resolve this, but that's still experimental for Eu.