Page MenuHomePhabricator

Implement JX.WebSocket
ClosedPublic

Authored by epriestley on Jan 6 2015, 3:41 PM.

Details

Summary

Ref T6559. Wraps WebSocket in a reasonable driver class which does event dispatch, some state management, and handles automatic reconnect.

Test Plan

In Safari, Firefox and Chrome, connected to a websocket server and sent messages back and forth. Terminated and restarted server, saw automatic reconnects successfully reestablish a connection on all browsers.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to [Draft] JX.WebSocket.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley retitled this revision from [Draft] JX.WebSocket to Implement JX.WebSocket.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: btrahan, joshuaspence.
  • Add some comments; reasonable basic implementation.
joshuaspence edited edge metadata.
joshuaspence added inline comments.
webroot/rsrc/externals/javelin/lib/Websocket.js
17 ↗(On Diff #27019)

Maybe lowercase?

68–70 ↗(On Diff #27019)

I feel that maybe this should happen at another layer... if you have asked for JX.WebSocket but your browser doesn't support WebSockets then we should probably throw an exception.

This revision is now accepted and ready to land.Jan 6 2015, 8:47 PM
epriestley edited edge metadata.
  • Rename to WebSocket for consistency.
  • Port connect delay fix from D11143 back here.
  • I'm keeping the semantics since they're slightly more natural for our use case. The send() semantics (where it just swallows messages when disconnected) are a little weird too, but make implementing the notification stuff easier. We could adjust this stuff later if we do something else with websockets.
This revision was automatically updated to reflect the committed changes.