Languages

Menu
Sites
Language
[Gear S] Websocket
Hi expert, I'm testing websocket in Gear S. but even if I could see "browser supports websocket", I couldn't see echo text from server. Config.xml has the necessary privilege and wi-fi is connected well. but I see "no connection" only. Any help will be appreciated

Enter the data to send:

Thanks in advance.

Responses

4 Replies
AVSukhov

Hello,

I have tested with another socket server on Gear S and all works fine.

js:

    var webSocketUrl = "ws://echo.websocket.org";
	var webSocket = new WebSocket(webSocketUrl);
	webSocket.onopen = function(e) 
	{
	   alert('connection open, readyState: ' + e.target.readyState);
	   webSocket.send("Rock it with HTML5 WebSocket");

	};

	webSocket.onerror = function(e) 
	{
		alert("error");
	};

	webSocket.onmessage = function(e) 
	{
	   alert('server message: ' + e.data);
	};

 

Gerald Jarvis

I've tested it with your server and working fine. thanks.

Bridget O

I am trying to get this code to work with a node.js server a laptop creates. The ip is a local ip, port number 3000

Code: 

 

//Initialize function
var wsUri = "ws://10.145.172.19:443/echo";
var websocket;
var output;
output = document.getElementById("output");
function writeToScreen(message) {
var pre = document.createElement("p");
pre.style.wordWrap = "break-word";
pre.innerHTML = message;
output.appendChild(pre);
}
function onMessage(evt) {
writeToScreen('<span style="color: blue;">RESPONSE: ' + evt.data+'</span>');
}
function onClose(evt) {
writeToScreen("DISCONNECTED");
}

But it goes straight to the onClose(evt) 

Any advice to get my Gear S to connect to my node.js server?

Thanks!

Seoghyun Kang

Hello,

When I watch the Tizen document, I can find that Tizen supports the WebSocket.

But when I tested the WebSocket, it did not work well as you. And my collegaue also had the same bad result. :(

 

However, when I watched the AVSukhov, he said it worked well.

After I test his code, I will share the result.  I hope that this was fixed. :)