Project: http://download.csdn.net/detail/wangshuxuncom/6430191
Description
This project shows you how to use the HTML5 WebSocket API to realize instant messaging capabilities.
Coding method of this project: UTF-8
Function Description:
1. This function supports multi-person chatting;
2, when someone online or offline, the session window will automatically display;
3. Support shortcut key Close Session window or send session information.
Environmental requirements:
1, Tomcat requires more than 7.0 of the version
Attention:
If 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 on Access is"//server computer IP: Port/websocket/".
Problems and Workarounds:
JAVA.LANG.NOSUCHMETHODEXCEPTION:ORG.APACHE.CATALINA.DEPLOY.WEBXML Addservlet
Workaround: Add <loader delegate= "true"/> In the Context tab 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 folder in the Tomcat installation folder 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 folder are copied to the Lib folder in the Tomcat installation folder.
Enable Instant Messaging with the HTML5 WebSocket API