我使用了sockjs websocket服务器的spring实现,无法传输超过8KB的消息,以下是错误
2014-02-12 19:36:29,990 - org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession - DEBUG - SockJS session id=35n41xel was closed, CloseStatus [code=1009, reason=The decoded text message was too big for the output buffer and the endpoint does not support partial messages]
Run Code Online (Sandbox Code Playgroud)
任何想法如何增加缓冲区大小
我使用以下工厂作为spring sockjs利用tomcat容器(App部署在tomcat中,我也调试确认它确实使用了tomcat lib)
@Bean
public WebSocketContainerFactoryBean createWebSocketContainer() {
WebSocketContainerFactoryBean container = new WebSocketContainerFactoryBean();
container.setMaxTextMessageBufferSize(16384);
container.setMaxBinaryMessageBufferSize(8192);
return container;
}
Run Code Online (Sandbox Code Playgroud)
然后我的URL映射看起来
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(coBrowseSockJsCustomerHandler(), "/sockjs/cobrowse/customer/").withSockJS();}
Run Code Online (Sandbox Code Playgroud)
我是否需要在某处设置sockjs这个bean?sockjs怎么知道它必须使用这个工具?
我知道如何在XML配置中启用异步支持,我已经通过添加标记对过滤器和servlet这样做了
async-supported>true/async-supported
Run Code Online (Sandbox Code Playgroud)
如何在Java配置文件中执行此操作.我创建了一个WebInit类来实现WebApplicationInitializer并覆盖onStartUp-我该怎么办呢?
public class WebInit implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext container) throws ServletException {
//What to do here, to move from XML to java config
}
}
Run Code Online (Sandbox Code Playgroud) 我看到记录器已经在Powermock的帮助下被嘲笑,或者某种被覆盖的构造函数需要记录器.
作为记录器在整个代码中使用,是不是他们使用mockito的简单方法?某种方式忽略调用或模拟它 - 我不想验证任何消息,只是想避免空指针异常
我是嘲笑框架的新手,所以我想知道使用Jmockit而不是混合和匹配两个库 - 到目前为止避免jomockit的唯一理由 - 太强大而且很容易被滥用!
对 Oauth 是否更多地用于身份验证有疑问。
几个问题
我有点迷失了
我正在使用SockJS客户端.SockJS构造函数将相对URL作为
var ws= new SockJS('/spring-websocket-test/sockjs/echo', undefined,{protocols_whitelist: [transport]});
Run Code Online (Sandbox Code Playgroud)
我们在哪里指出WSS://而不是WS://.如果我尝试绝对URL,则会出错:
XMLHttpRequest cannot load ws://localhost:8080/appname/app. Cross origin requests are only supported for HTTP.
_ws_onclose. wasClean: false code: 1002 reason: Can't connect to server
Run Code Online (Sandbox Code Playgroud)
不确定为什么会出现此错误.Spring Server Implementation需要任何类似的配置吗?