Commit Graph

12 Commits

Author SHA1 Message Date
nweiz@google.com 6b9b429688 Add a ListOutputStream.onData callback.
BUG=4335

Review URL: https://chromiumcodereview.appspot.com//10832145

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10298 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 18:25:14 +00:00
sgjesse@google.com 2eb76caab4 Add support for websocket PING and PONG frames
The handling of control frames have been refactored to uniformly
hanlde CLOSE, PING and PONG frames.

Currently this is not tested as I have bot found a good way to test it
yet. It has been somewhat tested with a browser client forcing ping
messages from the server and processing the pong responses from the
browser.

R=ager@google.com, ajohnsen@google.com

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com//10392195

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7844 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-22 10:34:47 +00:00
ajohnsen@google.com 657f789b1d Correctly handle the case of a 126 bytes long message, in WebSocket frame encoding.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10388159

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7678 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-16 08:43:08 +00:00
sgjesse@google.com 4166edd30b Remove the SHA1 implementation used by web sockets and use the dart:crypto library one instead.
R=ager@google.com

BUG=none
TEST=tests/standalone/io/web_socket_test.dart

Review URL: https://chromiumcodereview.appspot.com//10398010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7640 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-15 07:55:44 +00:00
sgjesse@google.com f861f1c2a0 Add a hash code to client and server web socket connections
The client web socket connection uses part of the nonce generated for
the challenge. The server web socket connection uses the hash code
from the socket.

R=ager@google.com

BUG=dart:3017
TEST=tests/standalone/io/web_socket_test.dart

Review URL: https://chromiumcodereview.appspot.com//10377124

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7613 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-14 15:53:28 +00:00
sgjesse@google.com a579f1f449 Implemented W3C complient web socket client interface
Fixed a bug where onMessage events could happen before the onOpen event.

R=ager@google.com, ajohnsen@google.com, vsm@google.com, jacobr@google.com

BUG=dart:2001
TEST=tests/standalone/io/web_socket_test.dart

Review URL: https://chromiumcodereview.appspot.com//10383039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7440 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-09 08:47:07 +00:00
sgjesse@google.com 4a4705b0a6 Fix bug in web socket close handling
Don't just close the socket when using the output stream for buffering
data - some data might not be sent.

This was causing the flakiness on Windows.

R=ager@google.com

BUG=dart:2867
TEST=tests/standalone/io/web_socket_test.dart

Review URL: https://chromiumcodereview.appspot.com//10316018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7280 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 13:02:59 +00:00
sgjesse@google.com 2904a46214 Implement onClosed on a socket output stream
onClosed on a socket output stream was never implemented.

Use this to correct the close handling of the web socket. Before it
was incorectly relying on no pending writes callback when closing the
connection which does not happen, so closing always happened throught
the timer.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10351009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7272 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-03 10:58:06 +00:00
sgjesse@google.com a108ef203f Add a web socket client
The web socket client is a implemented as a class which is
created from from a HTTP client connection. This way it is
independent from the HTTP client and is just using the HTTP
client.

The protocol handling is mainly re-using the code from the web
socket server.

Change the handling of setting an onNoPendingWrites handler on a
socket output stream. Now setting a new onNoPendingWrites handler
will trigger a callback when there is no pending data to be
written.

Add socket detaching to the HTTP client as well. Add the ability
to get any unparsed data read from the socket for processing
after the protocol upgrade.

R=ager@google.com, ajohnsen@google.com, vsm@google.com, jacobr@google.com

BUG=dart:2001
TEST=tests/standalone/io/web_socket_test.dart

Review URL: https://chromiumcodereview.appspot.com//10262031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7224 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-02 10:30:38 +00:00
ajohnsen@google.com feae5bc171 Fix WebSocket header construction for large frames.
The spec uses 8 bytes for length if it's larger then 65535. This was
only done when appending data to the header, not when setting the header
size.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10255002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7062 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-27 09:22:22 +00:00
sgjesse@google.com 773d86e5fe Add web socket protocol processor test
Unit test of the web socket protocol processor. This test includes
testing splitting a message into several frames.

Fixed the bugs found by adding a test.

R=ager@google.com, ajohnsen@google.com

BUG=dart:2001
TEST=tests/standalone/src/io/WebSocketProtocolProcessorTest.dart

Review URL: https://chromiumcodereview.appspot.com//10173021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7008 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-26 11:12:07 +00:00
sgjesse@google.com f4a87d0e2e Initial web socket server implementation
This implements the web socket protocol as a request handler for
the HTTP server. The HTTP server have been updated with the
ability of getting the socket when a HTTP upgrade request is
processed. This way the web socket implementation is not builtin
to the HTTP server.

The API on the server is:

interface WebSocketConnection {
  void set onMessage(void callback(Object message));
  void set onClosed(void callback(int status, String reason));
  void set onError(void callback(e));

  send(Object message);
  close([int status, String reason]);
}

This API currently does not have any streaming but collects the
entire message before invoking the onMessage callback. The
current browser web socket API
(http://dev.w3.org/html5/websockets/) works the same way. The
underlying web socket protocol can have unbounded messages so
long term this probably have to change. But for now the only
likely client for a web socket server is a browser.

Currently this is missing tests. The implementation has been
tested by running the WebSocketTest.dart script and connecting
using a browser. This testing have been done using Chrome 19 and
Firefox 11.

I will be adding tests in separate change lists.

The SHA-1 and base 64 code (initially written by
ajohnsen@google.com) can be removed when these algorithms is
available in the dart:crypto.

R=ager@google.com, ajohnsen@google.com, vsm@google.com, jacobr@google.com

BUG=dart:2001
TEST=none

Review URL: https://chromiumcodereview.appspot.com//10205012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6998 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-26 10:15:30 +00:00