A Java implementation of socket.io-emitter
This project uses msgpack-java and jedis.
JedisPool jedis = new JedisPool(new JedisPoolConfig(), "127.0.0.1", 6379);
Emitter emitter = Emitter.getInstance(jedis, new HashMap<String,String>());
Emitter emitter = Emitter.getInstance(null, opts);
emitter.of("/namespace").emit("event", "Hello World!");
HashMap<String,String> opts = new HashMap<String,String>();
opts.put("host", "127.0.0.1");
opts.put("port", "6379");
Emitter emitter = Emitter.getInstance(null, opts);
emitter.of("/namespace").emit("event", "Hello World!");
Possible flags
- json
- volatile
- broadcast
Emitter emitter = Emitter.getInstance(null, ImmutableMap.of("host", "127.0.0.1", "port", "6379"));
// broadcast can be replaced by any of the other flags
emitter.of("/namespace").broadcast().emit("event", "Hello World!");
Emitter emitter = Emitter.getInstance(null, ImmutableMap.of("host", "127.0.0.1", "port", "6379"));
String jsonData = "{\"test\":[\"test\",\"test1\"],\"name\":\"xxxxx\",\"id\":1234,\"float\":1234.00,\"bool\":true,\"object\":{\"name\":\"xxxxx\",\"id\":1234}}";
JSONObject jsonRoot = new JSONObject(jsonData);
emitter.of("/namespace").emit("event", jsonRoot);
This module requires a Redis to be available on the network.
Copyright © 2014 sunsus GmbH
Distributed under the MIT License.