Vibe JavaScript Client A is a lightweight B JavaScript client for browser-based C and Node-based D application.
- A
- Vibe 3.0.0-Alpha3 client.
- B
- 17.23KB minified, 6.04KB minified and gzipped.
- C
- The policy for browser support is the same with the one of jQuery 1.x that embraces Internet Explorer 6. Also it has no dependency in browser.
- D
- Though browser is the first runtime, it runs seamlessly on Node.js.
Quick Start
Vibe JavaScript Client is distributed at two places according to runtime engine: browser version through this web site in compressed and uncompressed forms and node version through npm.
Once you've loaded the module, you will be able to write the following echo and chat client. This page already loaded the uncompressed version, hence you can run and debug it directly here by using a JavaScript console and doing copy and paste.
var socket = vibe.open("http://localhost:8080/vibe");
socket.on("connecting", function() {
console.log("on connecting event");
})
.on("open", function() {
console.log("on open event");
socket.send("echo", "An echo message").send("chat", "A chat message");
})
.on("error", function(error) {
console.log("on error event", error);
})
.on("close", function() {
console.log("on close event");
})
.on("waiting", function(delay, attempts) {
console.log("on waiting event with delay", delay, "and attempts", attempts);
})
.on("echo", function(data) {
console.log("on echo event", data);
})
.on("chat", function(data) {
console.log("on chat event", data);
});
Further Reading
- To play something right now, start with archetype example.
- To take a brief look at API, check out the testee.
- To get details of API, see API document.
- To have a thorough knowledge of the implementation, read out the reference.