Home > other >  Half how jfinal websocket configuration (know)?
Half how jfinal websocket configuration (know)?

Time:09-20





Such as: the configuration for many times, also, according to the online tutorial watched, the configuration is not successful, The jfinal configuration websocket connection open failed;


Test a (failure) :


The original web site: http://www.codeweblog.com/jfinal-web-jfinal%E4%B8%8B%E7%9A%84%E5%9F%BA%E7%A1%80model%E5%AE%9E%E7%8E%B0%E4%BB%A5%E5%8F%8A%E6%95%B0%E6%8D%AE%E5%8E%8B%E7%BC%A9%E5%92%8C%E7%BC%93%E5%AD%98%E5%8F%8Awebsocket/





6. The websocket jfinal using websocket to avoid filtering jfinalFilter websocket path




Handlers. The add (new SkipHandler ("/im/* * "));//skip this directory

//a websocket connection
WebSocketSrv. Connect (" ws://localhost: 9090/im/" + user. Id)

//the server to the client sends the message
The MessageServer. Send (new Message (authorid, receiverId "Message"));




Test 2 (failure) :





The original http://www.oschina.net/question/1756755_157298? Sort=time








WebSocket

Com. Test. TestWebSocketServlet


WebSocket
/ws/test. Ws





I am code configuration of the click here:


http://www.tuicool.com/articles/IvuQzaq#c-22553



But all useless; Don't know the reason why

CodePudding user response:

Nginx reverse proxy to support WebSocket, when need to configure a few header, otherwise the connection to 404
Proxy_http_version 1.1;
Proxy_set_header Upgrade $http_upgrade;
Proxy_set_header Connection "upgrade".
Proxy_read_timeout 3600 s;//the time is not long, easy to disconnect
  • Related