Comments (7)
Hi @akostadinov ,
Thank you for the input. However, since I didn't have a use-case for the issue, I'm not sure what your expectations might be.
Could you offer some use-case examples?
Maybe this feature could be pushed to the 0.8.x version cycle.
Thanks!
Bo.
from iodine.
It is useful to know whether connection died or server disconnected us or we are shutting down (received a signal or whatever), etc.
If not for deciding whether to retry, it is important to log reasons when connection died. If I know the other server disconnected me, I would know to use shorter ping period or talk to the remote administrator. If I see there are timeouts or something local, then I would take other actions.
In this sense a feature for the server to log error events will also be a useful alternative.
Just as a comparison, this is how other libraries handle this:
https://github.com/faye/faye-websocket-ruby#using-the-websocket-client
My particular use case is that I want to monitor data streamed 24/7 and record it for analysis. Knowing why disconnections happened is ultimate for making the listener reliable.
from iodine.
Just now I realized that my client connections to wss://
just don't work. And have zero idea what the issue is. And I have spent a lot of time thinking that the remote service was broken. Not entirely iodine fault because I had troubles with websocat
official docker images which segfaulted but finally I've got a good websocat build that connected well to both ws://
and wss://
urls.
You can try a client connection to wss://websocket-echo-intustack.koyeb.app
and see that iodine as a client silently fails.
from iodine.
I agree, there's a bug somewhere... but...
I connected using (full code below):
Iodine.connect url: "ws://websocket-echo-intustack.koyeb.app", handler: EchoClient.new, ping: 40
# # or
# Iodine.connect address: "websocket-echo-intustack.koyeb.app", port: "80", handler: EchoClient.new, ping: 40, service: :ws
Iodine.start
Failed using TLS:
Iodine.connect address: "websocket-echo-intustack.koyeb.app", port: "443", handler: EchoClient.new, ping: 40, service: :wss
Iodine.start
I'm not sure yet where the issue originates, but I assume TLS support is lacking (and apparently I can't connect to localhost
except by using the loop-back ip 127.0.0.1
)...
Anyway, client side is one of the big changes for the 0.8.x version (under the hood)... so I'm hoping to resolve this.
I assume TLS is a must...?
The full code was:
require 'iodine'
# The client class
class EchoClient
def on_open(connection)
puts "* Client open"
@messages = [ "Hello World!",
"I'm alive and sending messages",
"I also receive messages",
"now that we all know this...",
"I can stop.",
"Goodbye." ]
send_one_message(connection)
end
def on_message(connection, message)
puts "Received: #{message}"
send_one_message(connection)
end
def on_close(connection)
# in this example, we stop iodine once the client is closed
puts "* Client closed."
Iodine.stop
end
# We use this method to pop messages from the queue and send them
#
# When the queue is empty, we disconnect the client.
def send_one_message(connection)
msg = @messages.shift
if(msg)
connection.write msg
else
connection.close
end
end
end
Iodine.threads = 1
Iodine.connect address: "websocket-echo-intustack.koyeb.app", port: "80", handler: EchoClient.new, ping: 40, service: :ws
Iodine.start
from iodine.
Yeah, I used this example from readme to construct my client. And same - ws://
works, wss://
silently exits. The server code is https://github.com/akostadinov/websocket-echo-io
I assume TLS is a must...?
For client side - yes. Otherwise I see no way to connect to any respectable online websocket service.
For server side I don't care much because as you pointed out in another issue, this is usually handled by a proxy layer as is the case with my websocket echo service.
from iodine.
I made a desperate attempt to workaround to no avail:
$ socat "UNIX-LISTEN:/tmp/echo,mode=660,reuseaddr,fork" EXEC:"openssl s_client -connect websocket-echo-intustack.koyeb.app -port 443 -servername websocket-echo-intustack.koyeb.app"
then
Iodine.connect address: "/tmp/echo", service: :ws, handler: Dump.new, ping: 40
from iodine.
FYI:
On my local machine, works with TLS (but connection doesn't close properly)...
Tested with:
Iodine.connect address: "127.0.0.1", port: "3000", handler: EchoClient.new, ping: 40, service: :wss
I'm wondering if its a timing / timeout error...
from iodine.
Related Issues (20)
- Iodine failing to compile with Ruby 3.2.0preview_2 HOT 5
- The future of iodine (vs. plezi)...? HOT 9
- [Rack 3] Response headers with Array value should produce multiple header fields HOT 3
- CPU usage when idle HOT 3
- Iodine.unsubscribe crashes when called with symbol. HOT 4
- Subscribing from the enter_master block subscribes even the children. HOT 3
- unix socket not writeable due umask HOT 8
- Writes to STDOUT even when Iodine.verbosity = 0 HOT 1
- Does not honor HUP signal. HOT 1
- Iodine stops on TERM signal with error when it run with -pid key and more than one worker HOT 1
- The Fixnum is gone as of Ruby-2.4 HOT 3
- response code 418 results in 500 Internal Server Error HOT 1
- Static file serving: allow mounting of multiple local dirs HOT 14
- binary C extension not built? HOT 26
- How to get client instance id HOT 3
- ondisconnect example HOT 1
- rage-rb HOT 1
- undefining the allocator of T_DATA class IodineObjectStorage at startup HOT 2
- Iodine failing to build in fedora 40 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iodine.