project:http://download.csdn.net/detail/wangshuxuncom/6430191
Description
This project demonstrates how to use the HTML5 WebSocket API to enable Instant Messaging functionality.
This project encoding method: UTF-8
Function Description:
1. This function supports multi-person chatting;
2, someone on-line or offline, the session window to realize their own active display;
3. Support shortcut key close the session form or send session information.
Environmental requirements:
1, Tomcat requires more than 7.0 of the version number
Attention:
Suppose you want to test on more than one computer, you need to change "ws://localhost:8080/websocket/sendmessage" in the Websocket.js file to "Ws://server computer Ip:port/websocket /sendmessage "HTTP is" http://server computer ip:port/websocket/"when asked.
Failure and Workaround:
JAVA.LANG.NOSUCHMETHODEXCEPTION:ORG.APACHE.CATALINA.DEPLOY.WEBXML Addservlet
Workaround: Add <loader delegate= "true"/> to the context tag in the Tomcat installation file Context.xml to resolve the issue.
Java.lang.NoSuchMethodError:org.apache.catalina.connector.RequestFacade.doUpgrade (lorg/apache/coyote/http11/ Upgrade/upgradeinbound;) V
Workaround: Locate the Lib directory in the Tomcat installation directory and delete the two jar files named "Catalina.jar" and "Tomcat-coyote.jar" in this project webroot-->web-inf--> The two jar files named "Catalina.jar" and "Tomcat-coyote.jar" in the Lib directory are copied to the Lib directory in the Tomcat installation directory.
Enable Instant Messaging with the HTML5 WebSocket API