Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added explanation of events to README

  • Loading branch information...
commit e86719bb55bc1ee9fbf83a54cab6a1c5b275b252 1 parent fdd87f5
@joewalnes authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 README.md
View
33 README.md
@@ -15,6 +15,39 @@ you can replace with:
Minified library with gzip compression is less than 600 bytes.
+How reconnections occur
+-----------------------
+
+With the standard `WebSocket` API, the events you receive from the WebSocket instance are typically:
+
+ onopen
+ onmessage
+ onmessage
+ onmessage
+ onclose // At this point the WebSocket instance is dead.
+
+With a `ReconnectingWebSocket`, after an `onclose` event is called it will automatically attempt to reconnect. In addition, a connection is attempted repeatedly (with a small pause) until it succeeds. So the events you receive may look something more like:
+
+ onopen
+ onmessage
+ onmessage
+ onmessage
+ onclose
+ // ReconnectingWebSocket attempts to reconnect
+ onopen
+ onmessage
+ onmessage
+ onmessage
+ onclose
+ // ReconnectingWebSocket attempts to reconnect
+ onopen
+ onmessage
+ onmessage
+ onmessage
+ onclose
+
+This is all handled automatically for you by the library.
+
More
----
Please sign in to comment.
Something went wrong with that request. Please try again.