• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SockJSServer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.vertx.java.core.sockjs.SockJSServer的典型用法代码示例。如果您正苦于以下问题:Java SockJSServer类的具体用法?Java SockJSServer怎么用?Java SockJSServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SockJSServer类属于org.vertx.java.core.sockjs包,在下文中一共展示了SockJSServer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startSockJSServer

import org.vertx.java.core.sockjs.SockJSServer; //导入依赖的package包/类
private void startSockJSServer() {
    HttpServer httpServer = vertx.createHttpServer();

    SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);

    JsonObject config = new JsonObject().putString("prefix", "/chat");
    sockJSServer.installApp(config, new Handler<SockJSSocket>() {
        public void handle(final SockJSSocket sock) {
            vertx.sharedData().getSet(SHARED_DATA_SOCKET_IDS).add(sock.writeHandlerID());
            sock.endHandler(new Handler<Void>() {
                @Override
                public void handle(Void aVoid) {
                    vertx.sharedData().getSet(SHARED_DATA_SOCKET_IDS).remove(sock.writeHandlerID());
                }
            });
        }
    });
    httpServer.listen(8083);
}
 
开发者ID:bytor99999,项目名称:SpringInAVertxWorld,代码行数:20,代码来源:ChatVerticle.java


示例2: bridge

import org.vertx.java.core.sockjs.SockJSServer; //导入依赖的package包/类
public void bridge(final CountingCompletionHandler<Void> countDownLatch) {
  HttpServer server = vertx.createHttpServer();
  SockJSServer sjsServer = vertx.createSockJSServer(server).setHook(hook);
  JsonObject empty = new JsonObject();
  JsonArray all = new JsonArray().add(empty);
  JsonArray inboundPermitted = config.getArray("inbound_permitted", all);
  JsonArray outboundPermitted = config.getArray("outbound_permitted", all);

  sjsServer.bridge(config.getObject("sjs_config", new JsonObject()
      .putString("prefix", "/channel")), inboundPermitted, outboundPermitted, config.getObject(
      "bridge_config", empty));

  countDownLatch.incRequired();
  server.listen(config.getInteger("port", 1986), config.getString("host", "0.0.0.0"),
      new AsyncResultHandler<HttpServer>() {
        @Override
        public void handle(AsyncResult<HttpServer> ar) {
          if (!ar.succeeded()) {
            countDownLatch.failed(ar.cause());
          } else {
            countDownLatch.complete();
          }
        }
      });
}
 
开发者ID:goodow,项目名称:realtime-channel,代码行数:26,代码来源:ChannelBridge.java


示例3: start

import org.vertx.java.core.sockjs.SockJSServer; //导入依赖的package包/类
public void start() {

        RouteMatcher routeMatcher = new RouteMatcher();

        // HTTP server
        HttpServer httpServer = vertx.createHttpServer();
        httpServer.requestHandler(routeMatcher);

        // SockJS server
        JsonArray permitted = new JsonArray();
        permitted.add(new JsonObject()); // Let everything through
        SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);
        sockJSServer.bridge(new JsonObject().putString("prefix", "/eventbus"), permitted, permitted);

        httpServer.listen(7777);

        System.out.println("Vert.X Core UP");
    }
 
开发者ID:rvillars,项目名称:bookapp-cqrs,代码行数:19,代码来源:VertXBean.java


示例4: start

import org.vertx.java.core.sockjs.SockJSServer; //导入依赖的package包/类
@Override
public void start() {
    final HttpServer httpServer = vertx.createHttpServer();
    final SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);
    final JsonObject config = new JsonObject().putString("prefix", "/echo");
    sockJSServer.installApp(config, new Handler<SockJSSocket>() {
        public void handle(final SockJSSocket sock) {

        }
    });
    httpServer.listen(8080);
}
 
开发者ID:bwinparty,项目名称:HelloVertX,代码行数:13,代码来源:WebSocketVerticle.java


示例5: createSockJSServer

import org.vertx.java.core.sockjs.SockJSServer; //导入依赖的package包/类
@Override
public SockJSServer createSockJSServer(HttpServer httpServer) {
  return null;
}
 
开发者ID:simondean,项目名称:vertx-async,代码行数:5,代码来源:FakeVertx.java


示例6: createSockJSServer

import org.vertx.java.core.sockjs.SockJSServer; //导入依赖的package包/类
@Override
public SockJSServer createSockJSServer(HttpServer httpServer) {
    return null;
}
 
开发者ID:amoAHCP,项目名称:vert.x-spring-microservice-demo,代码行数:5,代码来源:ServiceInfoTest.java


示例7: start

import org.vertx.java.core.sockjs.SockJSServer; //导入依赖的package包/类
@Override
void start(final JsonObject appConfig, HttpServer server) {

    eb              = vertx.eventBus();
    channel         = appConfig.getString("channel");
    sessionStore    = vertx.sharedData().getMap("_REFER_STORAGE");

    List<Module> deployments = new ArrayList<Module>();
    deployments.add(new Module(SubscribeManager.class.getName() , appConfig, 1, false   ));
    deployments.add(new Module(NodeWatchManager.class.getName() , appConfig, 1, false   ));
    deployments.add(new Module(PublishManager.class.getName()                           ));
    deployments.add(new Module(SessionManager.class.getName()   , appConfig             ));

    deployWorkerVerticles(deployments, new Handler<Void>() {
        public void handle(Void event) {
            INFO(" *** modules are deployed. *** ");

            JsonObject createNodeAction = new JsonObject();
            createNodeAction.putString("action", "create");
            createNodeAction.putString("channel", channel);
            createNodeAction.putObject("data",
                    new JsonObject()
                            .putObject("server"	, new JsonObject()
                                    .putString("host", appConfig.getString("host"))
                                    .putNumber("port", appConfig.getNumber("port")))
                            .putObject("redis", appConfig.getObject("redis-address"))
            );

            eb.send(NodeWatchManager.class.getName(), createNodeAction, new Handler<Message<JsonObject>>() {
                public void handle(Message<JsonObject> message) {
                    if("ok".equals(message.body().getString("status"))){
                        eb.send(NodeWatchManager.class.getName(), new JsonObject().putString("action", "watch"));
                    }
                }
            });

        }
    });





    SockJSServer sockServer = vertx.createSockJSServer(server);
    sockServer.installApp(
            new JsonObject().putString("prefix", "/message"),
            new SocketMessageHandler(vertx, channel)
    );

}
 
开发者ID:stalk-io,项目名称:stalk-server,代码行数:51,代码来源:MessageServer.java



注:本文中的org.vertx.java.core.sockjs.SockJSServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Context类代码示例发布时间:2022-05-23
下一篇:
Java TypeSerializer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap