WebSocket is now connecting
This commit is contained in:
parent
e6288e4ca7
commit
a6e19e7923
|
@ -1,4 +1,16 @@
|
||||||
|
|
||||||
|
// Create WebSocket connection.
|
||||||
|
const socket = new WebSocket ("ws://localhost:8080", "ooui-1.0");
|
||||||
|
|
||||||
alert("Hello");
|
console.log("Socket created");
|
||||||
|
|
||||||
|
// Connection opened
|
||||||
|
socket.addEventListener('open', function (event) {
|
||||||
|
console.log("Socket opened");
|
||||||
|
socket.send('Hello Server!');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listen for messages
|
||||||
|
socket.addEventListener('message', function (event) {
|
||||||
|
console.log('Message from server', event.data);
|
||||||
|
});
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace Ooui
|
||||||
{
|
{
|
||||||
WebSocketContext webSocketContext = null;
|
WebSocketContext webSocketContext = null;
|
||||||
try {
|
try {
|
||||||
webSocketContext = await listenerContext.AcceptWebSocketAsync(subProtocol: null).ConfigureAwait (false);
|
webSocketContext = await listenerContext.AcceptWebSocketAsync(subProtocol: "ooui-1.0").ConfigureAwait (false);
|
||||||
Console.WriteLine ("Accepted WebSocket: {0}", webSocketContext);
|
Console.WriteLine ("Accepted WebSocket: {0}", webSocketContext);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue