我有一个服务器websocket,如何在Delphi中连接我的服务器?
javascript中的示例
<script type="text/javascript">
// Websocket functions
function connectWebSocket() {
if ("WebSocket" in window) {
// Create new websocket connection
ws = new WebSocket("wss://localhost:8080");
// Called after connection is established
ws.onopen = function() {
enableInputs(true);
logMsg('Connected to: ' + ws.URL);
};
// Called when a new message is received
ws.onmessage = function (msg) {
if (msg.data) {
logMsg(msg.data);
}
};
// Called when connection is closed
ws.onclose = function() {
enableInputs(false);
logMsg("Connection closed!");
};
} else {
logMsg('Browser doesn\'t support websockets!');
}
}
</script>
我测试了IP * WORKS!,但它已付款,还有另一种选择吗?