当前位置: 首页>>代码示例>>Java>>正文


Java WebSocketHandlerRegistry类代码示例

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


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

示例1: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
       
       /** 
        * 支持websocket 的 connection 
        */  
       registry.addHandler(binaryGeometryTemplateSocketHandler,"/ws/binarygeometry/template").setAllowedOrigins("*").addInterceptors(new BinaryGeometryTemplateInterceptor()); 
       
       /** 
        * 如不支持websocket的connenction,采用sockjs 
        */  
       registry.addHandler(geometrySocketHandler,"/ws/geometry").setAllowedOrigins("*").addInterceptors(new GeometryInterceptor());
       //.withSockJS();
       
     	registry.addHandler(streamGeometrySocketHandler,"/ws/streamgeometry").setAllowedOrigins("*").addInterceptors(new StreamGeometryInterceptor());
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:17,代码来源:WebSocketConfig.java

示例2: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.SERVER);
    policy.setMaxTextMessageBufferSize(MAX_MSG_SIZE);
    policy.setMaxTextMessageSize(MAX_MSG_SIZE);
    policy.setIdleTimeout(IDLE_TIMEOUT);

    OcppWebSocketUpgrader upgradeStrategy = new OcppWebSocketUpgrader(
            policy, ocpp12WebSocketEndpoint, ocpp15WebSocketEndpoint, chargePointRepository);

    DefaultHandshakeHandler handler = new DefaultHandshakeHandler(upgradeStrategy);
    handler.setSupportedProtocols(PROTOCOLS);

    registry.addHandler(ocpp12WebSocketEndpoint, "/websocket/CentralSystemService/*")
            .addHandler(ocpp15WebSocketEndpoint, "/websocket/CentralSystemService/*")
            .setHandshakeHandler(handler)
            .setAllowedOrigins("*");
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:19,代码来源:WebSocketConfiguration.java

示例3: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    registry
        .addHandler(notificationHandler(), "/teapots")
        .addHandler(teapotHandler(), "/teapots/register/{teapotId}")
        .addHandler(consoleHandler(), "/teapots/{teapotId}")
        .setAllowedOrigins("*")    // allow all origins
        .addInterceptors(new UriTemplateHandshakeInterceptor());
}
 
开发者ID:hosuaby,项目名称:example-restful-project,代码行数:10,代码来源:WebSocketConfig.java

示例4: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.SERVER);
    policy.setMaxTextMessageBufferSize(MAX_MSG_SIZE);
    policy.setMaxTextMessageSize(MAX_MSG_SIZE);
    policy.setIdleTimeout(IDLE_TIMEOUT);

    OcppWebSocketUpgrader upgradeStrategy = new OcppWebSocketUpgrader(
            policy, ocpp12WebSocketEndpoint, ocpp15WebSocketEndpoint, chargePointRepository, notificationService);

    DefaultHandshakeHandler handler = new DefaultHandshakeHandler(upgradeStrategy);
    handler.setSupportedProtocols(PROTOCOLS);

    registry.addHandler(ocpp12WebSocketEndpoint, "/websocket/CentralSystemService/*")
            .addHandler(ocpp15WebSocketEndpoint, "/websocket/CentralSystemService/*")
            .setHandshakeHandler(handler)
            .setAllowedOrigins("*");
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve,代码行数:19,代码来源:WebSocketConfiguration.java

示例5: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
  if (AppConfig.isNonInteractive) {
    return;
  }
  registry.addHandler(new WebSocketHandler(), "/ws").withSockJS()
      .setClientLibraryUrl("https://cdn.jsdelivr.net/sockjs/1.1.4/sockjs.min.js");
}
 
开发者ID:sinaa,项目名称:train-simulator,代码行数:9,代码来源:WebSocketConfig.java

示例6: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
	registry.addHandler(new HotlineSocketHandler(), "/data");
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:4,代码来源:ChatSocketConfig.java

示例7: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    registry.addHandler(myHandler(), "/ws")
            .addInterceptors(new HandshakeInterceptor());
    registry.addHandler(myHandler(), "/ws/sockjs")
            .addInterceptors(new HandshakeInterceptor()).withSockJS();
}
 
开发者ID:chang20159,项目名称:Instant-Messaging,代码行数:8,代码来源:WebSocketConfig.java

示例8: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
	registry.addHandler(new JavametricsSpringSocketHandler(), "javametrics-dash/javametrics-socket");
}
 
开发者ID:RuntimeTools,项目名称:javametrics,代码行数:4,代码来源:JavametricsSpringConfigurer.java

示例9: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    String[] beans = context.getBeanNamesForAnnotation(WSHandler.class);
    for (String bean : beans) {
        WebSocketHandler handler = context.getBean(bean, WebSocketHandler.class);
        String[] path = handler.getClass().getAnnotation(WSHandler.class).value();
        registry.addHandler(handler, path).setAllowedOrigins("*").withSockJS();
        LOGGER.info("[WebSocket]注册 WebSocket path {} 到 {}", path, bean);
    }
}
 
开发者ID:csdbianhua,项目名称:telemarket-skittle-alley,代码行数:11,代码来源:WebSocketConfig.java

示例10: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    MessageRouter jsonMessageRouter = this.jsonMessageRouter();

    registry.addHandler(jsonMessageRouter, "/ws")
            .addInterceptors(httpSessionHandshakeInterceptor())
            .setAllowedOrigins("*");

    jsonMessageRouter.addHandler(serverMessageHandler());
}
 
开发者ID:apostx,项目名称:broadcast_server,代码行数:11,代码来源:WebSocketConfig.java

示例11: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
protected void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    CommandWebSocketMessageDispatcher dispatcher = new CommandWebSocketMessageDispatcher();
    dispatcher.setProcessorContainer(commandProcessorContainer);
    dispatcher.setUserTokenManager(userTokenManager);
    dispatcher.setWebSocketSessionListeners(webSocketSessionListeners);
    dispatcher.setTokenParsers(webSocketTokenParsers);
    registry.addHandler(dispatcher, "/sockjs")
            .setAllowedOrigins(allowedOrigins)
            .withSockJS()
            .setSessionCookieNeeded(true);
    registry.addHandler(dispatcher, "/socket")
            .setAllowedOrigins(allowedOrigins);
}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:15,代码来源:CommandWebSocketAutoConfiguration.java

示例12: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    registry
        .addHandler(spectateWebSocketHandler(), "/ws/spectate")
        .withSockJS()
        .setInterceptors(spectateHandshakeInterceptor());
}
 
开发者ID:nosceon,项目名称:tenorite,代码行数:8,代码来源:WebSocketConfig.java

示例13: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
	registry.addHandler(echoWebSocketHandler(), "/echo").setAllowedOrigins("*")
			.withSockJS();
	registry.addHandler(snakeWebSocketHandler(), "/snake").setAllowedOrigins("*")
			.withSockJS();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:SampleUndertowWebSocketsApplication.java

示例14: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    registry.addHandler(echoWebSocketHandler(), "/echo").setAllowedOrigins("*").withSockJS();
    registry.addHandler(greetingWebSocketHandler(), "/hello").setAllowedOrigins("*").withSockJS();
    registry.addHandler(closeWithCodeWebSocketHandler(), "/code").setAllowedOrigins("*").withSockJS();
    registry.addHandler(randomByteStreamWebSocketHandler(), "/stream").setAllowedOrigins("*").withSockJS();
}
 
开发者ID:hschott,项目名称:ready-websocket-plugin,代码行数:8,代码来源:SampleWebSocketsApplication.java

示例15: registerWebSocketHandlers

import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
  //@formatter:off
  registry
    .addHandler(clearHandler, clrPath)
    .addHandler(encHandler, encPath)
    .addInterceptors(new HttpSessionHandshakeInterceptor())
    .setHandshakeHandler(createHandshakeHandler());
  //@formatter:on
}
 
开发者ID:mrstampy,项目名称:gameboot,代码行数:11,代码来源:OtpWebSocketTestConfiguration.java


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