2A library for low latency HTTP communication. See the HTTP library for standard
3requests like GET, POST, etc.
6Elm.WebSocket = function() {
7 var JS = Elm.JavaScript;
9 /** open : String -> Signal String -> Signal String
10 Create a web-socket. The first argument is the URL of the desired
11 web-socket server. The input signal holds the outgoing messages,
12 and the resulting signal contains the incoming ones.
14 function open(url) { return function(outgoing) {
15 var incoming = Elm.Signal.constant(["Nil"]);
16 var ws = new window.WebSocket(JS.castStringToJSString(url));
21 ws.onopen = function(e) {
22 var len = pending.length;
23 for (var i = 0; i < len; ++i) { ws.send(pending[i]); }
26 ws.onmessage = function(event) {
27 Dispatcher.notify(incoming.id, JS.castJSStringToString(event.data));
31 var s = JS.castStringToJSString(msg);
32 ready ? ws.send(s) : pending.push(s);
35 function take1(x) { return function(y) { return x; } }
36 return Elm.Signal.lift2(take1)(incoming)(Elm.Signal.lift(send)(outgoing));
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list