在使用java作为后台测试微信小程序时,发现:
1.后台中ServerHttpRequest request中的session是空的,前端通过wx.connectSocket传递的data也没看到。
2.可以从前端网后台传递信息,但是后台往前端发送时会报出如下错误
有没有大神能告知下解决方案呢?
Java后台实现WebSocket时一共尝试了两种方案,一种是java+spring,一种是纯spring的,而且两者都会出现上面的情况,同时
其中:
springMVC时报如下错误:
Exception in thread "Thread-21" java.lang.IllegalStateException: The remote endpoint was in state [STREAM_WRITING] which is an invalid state for called method
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1225)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.textPartialStart(WsRemoteEndpointImplBase.java:1182)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(WsRemoteEndpointImplBase.java:222)
at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:49)
at org.springframework.web.socket.adapter.standard.StandardWebSocketSession.sendTextMessage(StandardWebSocketSession.java:197)
at org.springframework.web.socket.adapter.AbstractWebSocketSession.sendMessage(AbstractWebSocketSession.java:104)
at cn.zhonya.WXTalkDome.webSocket.MyWebSocketHandler$1.run(MyWebSocketHandler.java:139)
at java.lang.Thread.run(Thread.java:745)
java+spring时会报如下错误:
java.lang.IllegalStateException: The remote endpoint was in state [WRITER_WRITING] which is an invalid state for called method
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1225)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBa