mirror of
https://github.com/dsward2/macSVG.git
synced 2026-03-02 18:23:58 +01:00
21 lines
467 B
JavaScript
Executable File
21 lines
467 B
JavaScript
Executable File
function WebSocketTest2()
|
|
{
|
|
if ("WebSocket" in window)
|
|
{
|
|
var ws = new WebSocket("%%WEBSOCKET_URL%%");
|
|
ws.onopen = function()
|
|
{
|
|
// Web Socket is connected
|
|
alert("websocket is open");
|
|
|
|
// You can send data now
|
|
ws.send("Hey man, you got the time?");
|
|
};
|
|
ws.onmessage = function(evt) { alert("received: " + evt.data); };
|
|
ws.onclose = function() { alert("websocket is closed"); };
|
|
}
|
|
else
|
|
{
|
|
alert("Browser doesn't support WebSocket!");
|
|
}
|
|
} |