jscoket完整示例demo下载

  jscoket完整示例demo下载,包含jsocket.swf文件和源代码。其中服务器端提供了java和php2种,C#代码没有给出。C#源代码可以去这里下载:C# WebSocketServer服务器源代码

  jsocket项目地址:https://code.google.com/p/jsocket/

  svn下载地址:http://jsocket.googlecode.com/svn/trunk/jsocket/

使用demo

<html>
	<head>
		<title>WebSocket Wrapper test</title>
		<script src="http://swfobject.googlecode.com/svn/trunk/swfobject/src/swfobject.js" type="text/javascript"></script>
		<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>
		<script type="text/javascript" src="jsocket.js"></script>
		<script type="text/javascript" src="jsocket.advanced.js"></script>
		<script type="text/javascript" src="WebSocket-wrapper.js"></script>
	</head>
	<body>
		Example borrowed from http://www.codeproject.com/KB/webservices/c_sharp_web_socket_server.aspx
			
		<script type="text/javascript">		
		
		if('WebSocket' in window){
		 connect('ws://localhost:8181/service');
		}
 
		function connect(host) {
		  var ws = new WebSocket(host);
		  ws.onopen = function () {
			alert('connected');
			ws.send("test1234");
		  };
		 
		  ws.onmessage = function (evt) {  
			alert('reveived data:'+evt.data);
		  };
		 
		  ws.onclose = function () {
			alert('socket closed');
		  };
		};
		</script>
	</body>
</html>

 

阅读(371)喜欢(0)不喜欢(0)153.8KB浏览器,flash 点击下载