javascript - WebSocket Error on Android Device, Works in IE -


i have issue websocket client.

it seems work fine in ie , edge. server responds message , client receives , displays message, when android device runs code, error handler gets fired off , connection closed immediately.

the error handler gives me message: "undefined"

here client:

<!doctype html>  <html>    <head>      <title>html5 touch tracing </title>      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">  	<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>  	<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>        <script type='text/javascript'>          function opensocket(){                                if ("websocket" in window)              {                 alert("websocket supported browser!");                                  //var websocket = require('ws');                 var ws = new websocket("ws://localhost:8080/websocketserver/control");                                               ws.onopen = function ()                              {                                  // web socket connected, send data using send()                                  ws.send("message send");                                  alert("message sent...");                              };                                ws.onmessage = function (evt)                              {                                  var received_msg = evt.data;                                                                    alert("message = " + received_msg);                              };                                ws.onclose = function ()                              {                                  // websocket closed.                                  alert("connection closed...");                              };  							ws.onerror = function(evt)  							{  								alert("error: " + evt.data);  							};              } else              {                  alert("websocket not supported browser!");              }  	                        		}      </script>    </head>    <body>    	<meta name="viewport" content="width=device-width,user-scalable=no">              	<div>    		<a href="javascript:opensocket();" class="ui-btn ui-btn-inline" id="button">keyboard</a>    	</div>    </body>  </html>

my server responds message:

@onmessage public string onmessage(string message) {     return "got it."; } 


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -