Skip to content
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

Cannot connect to rippled WebSocket API using Dart client. #22

Closed
gmosx opened this issue Mar 16, 2013 · 3 comments
Closed

Cannot connect to rippled WebSocket API using Dart client. #22

gmosx opened this issue Mar 16, 2013 · 3 comments

Comments

@gmosx
Copy link

gmosx commented Mar 16, 2013

rippled.cfg:
...
[websocket_ip]
127.0.0.1

[websocket_port]
6006
...

$ ./rippled --net

Dart code:

WebSocket.connect('ws://127.0.0.1:6006').then((WebSocket socket) {
print('Connected');
socket.listen((message) {
print(message);
},
onDone: () {
});
socket.send('{"command":"subscribe","id":0,"streams":["server", "ledger", "transactions"]}');
});

Expected:

Dart should start receiving streaming data.

Actual:

print('Connected') is not called. Interestingly if I shutdown rippled while keeping the Dart client running I get:

Uncaught Error: HttpParserException: Connection closed before full header was received
Unhandled exception:
HttpParserException: Connection closed before full header was received
#0 _FutureImpl._scheduleUnhandledError. (dart:async:349:9)
#1 Timer.run. (dart:async:2251:21)
#2 Timer.run. (dart:async:2258:13)
#3 Timer.Timer. (dart:async-patch:9:15)
#4 _Timer._createTimerHandler._handleTimeout (dart:io:5987:28)
#5 _Timer._createTimerHandler._handleTimeout (dart:io:5995:7)
#6 _Timer._createTimerHandler. (dart:io:6003:23)
#7 _ReceivePortImpl._handleMessage (dart:isolate-patch:40:92)

@ghost ghost assigned JoelKatz Mar 16, 2013
@JoelKatz
Copy link
Collaborator

There were a few minor issues with how we check for the end of the HTTP headers that were causing this error. Those are fixed with commit e310b49.

Next, websocketpp wouldn't accept an "upgrade" header, which is what Dart sends. It insists on "Upgrade". That is also fixed with the same commit.

However, we're still dead in the water because of this issue:
zaphoyd/websocketpp#101

"Short Key 3: A0 A3 7F 46 8E 7F bytes missing: 8 eofbit: true failbit: true badbit: false goodbit: false
Full Key3 not found in first chop"

Possible solutions include:

  1. Finding a websocket library for Dart that's less unusual.
  2. Getting the parsing issues in websocketpp fixed.
  3. Switching Rippled to a different websocket library. (We have a long history of being not too please with this one.)

@gmosx
Copy link
Author

gmosx commented Mar 16, 2013

  1. Finding a websocket library for Dart that's less unusual.

Since this library is included in the SDK, it's highly unlikely that anyone will come up with an alternative.

@JoelKatz
Copy link
Collaborator

Fixed with commit 986cce6
The remaining issue was other headers that were also not found by websocketpp because of case differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants