websocket-client-simple | Simple WebSocket Client on Ruby | Websocket library
kandi X-RAY | websocket-client-simple Summary
kandi X-RAY | websocket-client-simple Summary
Simple WebSocket Client on Ruby
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of websocket-client-simple
websocket-client-simple Key Features
websocket-client-simple Examples and Code Snippets
Community Discussions
Trending Discussions on websocket-client-simple
QUESTION
I am writing a Sinatra web server that I would like to be RESTful, but the thing is that it has to interact with another server that communicates exclusively via web sockets. So, this needs to happen:
- A request comes into my Sinatra server from a client
- My server opens a web socket to the foreign server
- My server asynchronously waits for messages and things from the foreign server until the socket is closed (this should only take two hundred or so milliseconds)
- My server sends back a response to client
I'm sure this is not too complicated to accomplish, but I'm a bit stuck on it. Basically, if the entire web socket logic can be wrapped in a single function, then that function could be made to be blocking, and that'd be that. But I don't know how to wrap the web socket logic and block it. What do you think? A simplified version of what I've got is below.
...ANSWER
Answered 2017-Oct-25 at 19:39The problem was that async-sinatra
was using its own threads, and so was websocket-client-simple
. The solution is to use bindings and the eval
function, though this is not very efficient at all. I am hoping that optimizations or better solutions are available.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install websocket-client-simple
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page