當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。