0.0.2-0 • Published 10 years ago

xavi-service-echo v0.0.2-0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

Xavi - Realtime Channel Server Build Status

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:

License

Xavi is distributed under the terms of the MIT License.

© 2014 Football Radar

0.0.2-0

10 years ago

0.0.1-0

10 years ago

0.0.0-3

10 years ago