Closed WA9ACE closed 5 years ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
lib/async/websocket/connection.rb | 1 | 2 | 50.0% | ||
<!-- | Total: | 1 | 2 | 50.0% | --> |
Totals | |
---|---|
Change from base Build 53: | -0.1% |
Covered Lines: | 71 |
Relevant Lines: | 78 |
While I agree with this change, it's going to break all existing use cases. For me "message" is structured data. The default is JSON for websockets, no? So if we want to send/receive raw data maybe we need different method, like read
/write
Also, need specs.
Okay, I rebuilt this library and now you can do it however you want.
The way to do it is to make your own custom "Connection" object which handles everything above the framing layers.
You should do something like:
Async::WebSocket::Server::Rack.open(env, connection_klass: MyConnection) do |connection|
# connection is an instance of MyConnection
MyConnection
should derive from Async::WebSocket::Connection
which implements the base functionality.
Does this suit your use case?
Please see the update to #9, and feel free to make a PR if you feel there is some way to improve it further.
Solves issue #9