本文整理汇总了Java中org.glassfish.grizzly.websockets.WebSocketEngine类的典型用法代码示例。如果您正苦于以下问题:Java WebSocketEngine类的具体用法?Java WebSocketEngine怎么用?Java WebSocketEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebSocketEngine类属于org.glassfish.grizzly.websockets包,在下文中一共展示了WebSocketEngine类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerWebsocket
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
private void registerWebsocket() throws IOException {
Configuration configuration = ConfigurationReader.INSTANCE.readConfiguration("core-site.xml");
websocketServicePort = Integer
.parseInt(configuration.get("events.server.websocket.port", "8082"));
try {
ServerSocket s = new ServerSocket(websocketServicePort);
websocketServicePort = s.getLocalPort();
s.close();
waitTillSocketIsClosed(s);
String webSocketserviceHost = java.net.InetAddress.getLocalHost().getHostAddress();
final HttpServer server = HttpServer.createSimpleServer(null, webSocketserviceHost,
websocketServicePort);
for (NetworkListener listener : server.getListeners()) {
listener.registerAddOn(new WebSocketAddOn());
}
WebSocketEngine.getEngine().register("", "/event-stream", new EventsSocketApplication());
server.start();
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
}
}, "Server-Showdown-Thread"));
} catch (IOException | InterruptedException e) {
throw new IllegalStateException("Failed to start api-service. name = events.service", e);
}
}
开发者ID:DataRPM-Labs,项目名称:sigma-events,代码行数:30,代码来源:EventEngineAPIServiceStarter.java
示例2: httpServer
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Bean
public HttpServer httpServer()
throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException,
FileNotFoundException, CertificateException, UnrecoverableEntryException, ConfigurationException {
HttpServer server = HttpServer.createSimpleServer("./", 8080);
WebSocketAddOn addon = new WebSocketAddOn();
server.getListeners().stream().forEach((listen) -> {
listen.registerAddOn(addon);
listen.setSecure(true);
listen.setSSLEngineConfig(
new SSLEngineConfigurator(this.sslConf()).setClientMode(false).setNeedClientAuth(false));
});
String messengerPath = configuration().getString(GlobalConfig.MESSENGER_PATH);
if (messengerPath == null) {
messengerPath = GlobalConfig.MESSENGER_PATH_DEFAULT;
}
ChatApplication application = this.chatApplication();
WebSocketEngine.getEngine().register("", messengerPath, application);
return server;
}
开发者ID:shilongdai,项目名称:LSChatServer,代码行数:23,代码来源:ApplicationRootContext.java
示例3: startServer
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
private HttpServer startServer(URI uri) throws IOException {
ResourceConfig rc = new RallyeApplication();
HttpServer serv = createServer(uri, rc); // Do NOT start the server just yet
logger.info("Starting Grizzly server at " + uri);
//Register Websocket Stuff
WebSocketAddOn addon = new WebSocketAddOn();
for(org.glassfish.grizzly.http.server.NetworkListener listener : serv.getListeners()) {
logger.info("Registering websocket on "+listener);
listener.registerAddOn(addon);
}
PushWebsocketApp.setData(RallyeBinder.data); //TODO: Remove this ugliness.
AdminWebsocketApp.setData(RallyeBinder.data); //TODO: Remove this ugliness.
WebSocketEngine.getEngine().register("/rallye", "/push", PushWebsocketApp.getInstance());
WebSocketEngine.getEngine().register("/rallye","/admin", AdminWebsocketApp.getInstance());
serv.start();
return serv;
}
开发者ID:jakobwenzel,项目名称:rallye-server,代码行数:20,代码来源:RallyeServer.java
示例4: enable
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Override
public void enable() {
LOGGER.info("register WebSocket on path \"" + WS_PATH + "\"...");
wsApp = new SystemMonitorApplication();
WebSocketEngine.getEngine().register("", WS_PATH, wsApp);
timer = new Timer();
timer.scheduleAtFixedRate(new SystemMonitorTask(this), 0, 1000);
enabled = true;
}
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:10,代码来源:SystemMonitorPlugin.java
示例5: disable
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Override
public void disable() {
if (wsApp != null) {
LOGGER.info("unregister WebSocket on path \"" + WS_PATH + "\"...");
WebSocketEngine.getEngine().unregister(wsApp);
}
Optional.ofNullable(timer).ifPresent(Timer::cancel);
enabled = false;
}
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:10,代码来源:SystemMonitorPlugin.java
示例6: enable
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Override
public void enable() {
exePath = findExecutableOnPath(NV_EXECUTABLE);
if (exePath != null) {
thread = new Thread(this);
thread.start();
LOGGER.info("register WebSocket on path \"" + WS_PATH + "\"...");
wsApp = new NVMonitorApplication();
WebSocketEngine.getEngine().register("", WS_PATH, wsApp);
enabled = true;
}
}
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:13,代码来源:NVMonitorPlugin.java
示例7: disable
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Override
public void disable() {
if (wsApp != null) {
LOGGER.info("unregister WebSocket on path \"" + WS_PATH + "\"...");
WebSocketEngine.getEngine().unregister(wsApp);
}
if (thread != null) {
timer.cancel();
thread.interrupt();
}
enabled = false;
}
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:14,代码来源:NVMonitorPlugin.java
示例8: startServer
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Override
protected void startServer(int port, Action<ServerWebSocket> websocketAction) throws Exception {
server = HttpServer.createSimpleServer(null, port);
NetworkListener listener = server.getListener("grizzly");
listener.registerAddOn(new WebSocketAddOn());
WebSocketEngine.getEngine().register("", TEST_URI, new AsityWebSocketApplication()
.onwebsocket(websocketAction));
server.start();
}
开发者ID:cettia,项目名称:asity,代码行数:10,代码来源:GrizzlyServerWebSocketTest.java
示例9: startServer
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Override
protected void startServer() throws Exception {
server = HttpServer.createSimpleServer(null, port);
NetworkListener listener = server.getListener("grizzly");
listener.registerAddOn(new WebSocketAddOn());
WebSocketEngine.getEngine().register("", "/test", new VibeWebSocketApplication().onwebsocket(performer.serverAction()));
server.start();
}
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:9,代码来源:GrizzlyServerWebSocketTest.java
示例10: register
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Startup
protected static void register() {
app = new ConverterApplication();
WebSocketEngine.getEngine().register("", "/ws/converter", app);
}
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:6,代码来源:ConverterApplication.java
示例11: unregister
import org.glassfish.grizzly.websockets.WebSocketEngine; //导入依赖的package包/类
@Shutdown
protected static void unregister() {
WebSocketEngine.getEngine().unregister(app);
}
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:5,代码来源:ConverterApplication.java
注:本文中的org.glassfish.grizzly.websockets.WebSocketEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论