Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

websocket - web-socket reverse proxy using sprint-boot gets disconnects with error text_partial_writing

I am using this web-proxy code to have reverse websocket proxy using spring-boot, it works during initial connection after that I get this below error

java.lang.illegalstateexception: the remote endpoint was in state [text_partial_writing] which is an invalid state for called method at 

org.apache.tomcat.websocket.wsremoteendpointimplbase$statemachine.checkstate(wsremoteendpointimplbase.java:1234) at org.apache.tomcat.websocket.wsremoteendpointimplbase$statemachine.textpartialstart(wsremoteendpointimplbase.java:1191) 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:215) at org.springframework.web.socket.adapter.abstractwebsocketsession.sendmessage(abstractwebsocketsession.java:106) at com.javainuse.websocket.config.nexthop.sendmessagetonexthop(nexthop.java:61) at com.javainuse.websocket.config.websocketproxyserverhandler.handlemessage(websocketproxyserverhandler.java:33) at org.springframework.web.socket.handler.websockethandlerdecorator.handlemessage(websockethandlerdecorator.java:75) at org.springframework.web.socket.handler.loggingwebsockethandlerdecorator.handlemessage(loggingwebsockethandlerdecorator.java:56) at org.springframework.web.socket.handler.exceptionwebsockethandlerdecorator.handlemessage(exceptionwebsockethandlerdecorator.java:58) at org.springframework.web.socket.adapter.standard.standardwebsockethandleradapter.handletextmessage(standardwebsockethandleradapter.java:114) at org.springframework.web.socket.adapter.standard.standardwebsockethandleradapter.access$000(standardwebsockethandleradapter.java:43) at org.springframework.web.socket.adapter.standard.standardwebsockethandleradapter$3.onmessage(standardwebsockethandleradapter.java:85) at org.springframework.web.socket.adapter.standard.standardwebsockethandleradapter$3.onmessage(standardwebsockethandleradapter.java:82) at org.apache.tomcat.websocket.wsframebase.sendmessagetext(wsframebase.java:395) at org.apache.tomcat.websocket.server.wsframeserver.sendmessagetext(wsframeserver.java:119) at org.apache.tomcat.websocket.wsframebase.processdatatext(wsframebase.java:495) at org.apache.tomcat.websocket.wsframebase.processdata(wsframebase.java:294) at org.apache.tomcat.websocket.wsframebase.processinputbuffer(wsframebase.java:133) at org.apache.tomcat.websocket.server.wsframeserver.ondataavailable(wsframeserver.java:82) at org.apache.tomcat.websocket.server.wsframeserver.doondataavailable(wsframeserver.java:171) at org.apache.tomcat.websocket.server.wsframeserver.notifydataavailable(wsframeserver.java:151) at org.apache.tomcat.websocket.server.wshttpupgradehandler.upgradedispatch(wshttpupgradehandler.java:148) at org.apache.coyote.http11.upgrade.upgradeprocessorinternal.dispatch(upgradeprocessorinternal.java:54) at org.apache.coyote.abstractprocessorlight.process(abstractprocessorlight.java:59) at org.apache.coyote.abstractprotocol$connectionhandler.process(abstractprotocol.java:868) at org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1590) at org.apache.tomcat.util.net.socketprocessorbase.run(socketprocessorbase.java:49) at java.base/java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1128) at java.base/java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:628) at org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) at java.base/java.lang.thread.run(thread.java:834)

I added synchronized block here for sendMessage but still getting the same error at this line

Is there a other java websocket proxy code ?

I tried to use spring-cloud-gateway but it is not compatible with spring-starter-web(i can not remove web due to spring MVC dependency in the code)

question from:https://stackoverflow.com/questions/65832603/web-socket-reverse-proxy-using-sprint-boot-gets-disconnects-with-error-text-part

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...