port = CreateObject("roMessagePort")
connection = {}
sendAddress = CreateObject("roSocketAddress")
sendAddress.SetAddress("echo.websocket.org:80")' WebSocket test server -> http://www.websocket.org/echo.html '
sock = CreateObject("roStreamSocket")
sock.setMessagePort(port)
sock.SetSendToAddress(sendAddress)
sock.notifyReadable(true)
sock.Listen(3)
If not sock.eOK() then
print "socket error"
stop
End If
If sock.Connect()
Print "Connected Successfully"
Else
Print "Connection failed"
End If
while True
ssevent = port.WaitMessage(0)
if type(ssevent) = "roSocketEvent"
print "connection established from port"
end if
end while