本文整理汇总了Java中com.corundumstudio.socketio.Configuration类的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Configuration类属于com.corundumstudio.socketio包,在下文中一共展示了Configuration类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: start
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
public static void start() throws InterruptedException {
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(9092);
final SocketIOServer server = new SocketIOServer(config);
server.addEventListener("chatevent", ChatObject.class, new DataListener<ChatObject>() {
@Override
public void onData(SocketIOClient client, ChatObject data, AckRequest ackRequest) {
server.getBroadcastOperations().sendEvent("chatevent", data);
}
});
server.start();
Thread.sleep(Integer.MAX_VALUE);
server.stop();
}
开发者ID:ScreenBasedSimulator,项目名称:ScreenBasedSimulator,代码行数:21,代码来源:EventChatLauncher.java
示例2: start
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
public static void start() throws InterruptedException, UnsupportedEncodingException {
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(9092);
config.setMaxFramePayloadLength(1024 * 1024);
config.setMaxHttpContentLength(1024 * 1024);
final SocketIOServer server = new SocketIOServer(config);
server.addEventListener("msg", byte[].class, new DataListener<byte[]>() {
@Override
public void onData(SocketIOClient client, byte[] data, AckRequest ackRequest) {
client.sendEvent("msg", data);
}
});
server.start();
Thread.sleep(Integer.MAX_VALUE);
server.stop();
}
开发者ID:ScreenBasedSimulator,项目名称:ScreenBasedSimulator,代码行数:24,代码来源:BinaryEventLauncher.java
示例3: getServerFor
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
@NotNull
private static SocketIOServer getServerFor(@NotNull String hostname, int port) {
String key = hostname + ":" + port;
if (servers.containsKey(key)) {
return servers.get(key);
} else {
Configuration config = new Configuration();
config.setHostname(hostname);
config.setPort(port);
SocketIOServer server = new SocketIOServer(config);
final SocketIOServer socketIOServer = servers.putIfAbsent(key, server);
if (socketIOServer == null) {
// server.start();
}
return server;
}
}
开发者ID:sillelien,项目名称:dollar,代码行数:20,代码来源:SocketURIHandler.java
示例4: init
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
public void init(){
Configuration config = new Configuration();
config.setHostname("127.0.0.1");
config.setPort(port);
server = new SocketIOServer(config);
server.addListeners(new SioChatListener(server));
server.start();
}
开发者ID:xuxueli,项目名称:xxl-push,代码行数:11,代码来源:SioChatServer.java
示例5: start
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
/**
*
*/
public void start() {
// Iniciando controle do mouse
mouse = new MouseControll();
// Server configuration
Configuration config = getServerConfiguration();
// Server initialization
server = new SocketIOServer(config);
// Add server listeners
server = setServerListeners(server);
// Star server
LOGGER.info(i18nMessages.getString("server.initializing"));
try {
server.start();
serverInfo = new ServerInfo(
server.getConfiguration().getHostname(),
server.getConfiguration().getPort());
callback.serverStarted(serverInfo);
running = true;
} catch (Exception ex) {
callback.error(ex.getMessage());
running = false;
}
}
开发者ID:rodrigogs,项目名称:mouseless-server,代码行数:35,代码来源:Server.java
示例6: getServerConfiguration
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
/**
* @return
*/
private Configuration getServerConfiguration() {
LOGGER.info(i18nMessages.getString("server.generating.server.configuration"));
Configuration config = new Configuration();
config.setHostname(host);
config.setPort(port);
return config;
}
开发者ID:rodrigogs,项目名称:mouseless-server,代码行数:14,代码来源:Server.java
示例7: start
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
public static void start() throws InterruptedException {
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(9092);
final SocketIOServer server = new SocketIOServer(config);
server.addEventListener("ackevent1", ChatObject.class, new DataListener<ChatObject>() {
@Override
public void onData(final SocketIOClient client, ChatObject data, final AckRequest ackRequest) {
// check is ack requested by client,
// but it's not required check
if (ackRequest.isAckRequested()) {
// send ack response with data to client
ackRequest.sendAckData("client message was delivered to server!", "yeah!");
}
// send message back to client with ack callback WITH data
ChatObject ackChatObjectData = new ChatObject(data.getUserName(), "message with ack data");
client.sendEvent("ackevent2", new AckCallback<String>(String.class) {
@Override
public void onSuccess(String result) {
System.out.println("ack from client: " + client.getSessionId() + " data: " + result);
}
}, ackChatObjectData);
ChatObject ackChatObjectData1 = new ChatObject(data.getUserName(), "message with void ack");
client.sendEvent("ackevent3", new VoidAckCallback() {
protected void onSuccess() {
System.out.println("void ack from: " + client.getSessionId());
}
}, ackChatObjectData1);
}
});
server.start();
Thread.sleep(Integer.MAX_VALUE);
server.stop();
}
开发者ID:ScreenBasedSimulator,项目名称:ScreenBasedSimulator,代码行数:45,代码来源:AckChatLauncher.java
示例8: ArsnovaSocketioServerImpl
import com.corundumstudio.socketio.Configuration; //导入依赖的package包/类
public ArsnovaSocketioServerImpl() {
config = new Configuration();
}
开发者ID:thm-projects,项目名称:arsnova-backend,代码行数:4,代码来源:ArsnovaSocketioServerImpl.java
注:本文中的com.corundumstudio.socketio.Configuration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论