JavaScript: Add basic model of client-side socket.io API.

This commit is contained in:
Max Schaefer
2019-02-27 16:37:59 +00:00
parent 363c11e89d
commit b47b26ca61
22 changed files with 200 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
var sock = require("socket.io-client")("ws://localhost");
require("socket.io-client").connect("http://example.com/foo/bar?q=v#abc");
sock.on('message', (x, y) => {
console.log(x, y);
})
sock.on(eventName(), (msg) => {});
sock.on('data', (x, cb) => {
cb("received");
});
sock.emit('data', "hi", "there");
sock.write("do you copy?", () => {});