0.0.2-0 • Published 10 years ago
xavi-service-echo v0.0.2-0
Xavi - Realtime Channel Server
WebSocket interface for highly distributed systems
Echo service binding (node.js)
Echoes or broadcasts messages to all connected clients.
Getting started
Server
Install Xavi and echo service
npm install xavi xavi-service-echo
Create a new Xavi server
var xavi = require("xavi");
var app = xavi.createServer();
Add echo service binding
var EchoService = require("xavi-service-echo");
app.services.bind("echo.channel", EchoService);
Start server
app.listen(8080, "localhost");
Client
Connect browser client
define(["xavi"], function(xavi) {
var client = new xavi.Client({
host: "localhost",
port: 8080
});
client.connect();
});
Send and receive messages
client.on("open", function() {
client.send(new xavi.Message({
channel: "echo.channel",
command: "echo",
data: "Test message"
}));
});
client.on("message", function(message) {
console.log(message.data); // "Test message"
});
Broadcast to all connected clients
client.send(new xavi.Message({
channel: "echo.channel",
command: "broadcast",
data: "Test message"
}));
To get up and running with the client library, please visit the xavi-client repository.
Contributing
Xavi is completely open source, and welcomes community contributions.
Before you start, please read our contribution guidelines.
At a glance
- Fork this repository
- Create a new branch
- When ready, submit a pull request
To contribute to other Xavi projects, visit the relevant repos:
- xavi - Server library
- xavi-client - Client library
- xavi-middleware-auth - Authentication middleware
- xavi-middleware-cookie - Cookie middleware
- xavi-service-irc - IRC service binding
- xavi-service-rabbitmq - RabbitMQ service binding
- xavi-service-redis - Redis service binding
- xavi-service-thrift - Thrift service binding
- xavi-service-zookeeper - ZooKeeper service wrapper
License
Xavi is distributed under the terms of the MIT License.
© 2014 Football Radar