From 9beec2ff3a95ebabcba94ba13b4b91fa05fcd384 Mon Sep 17 00:00:00 2001 From: Luca Conte Date: Wed, 21 Aug 2024 17:02:29 +0200 Subject: [PATCH] update readme --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cbdd0dd..d71a5d0 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,19 @@ ```js // constructor(socketAddress, options = [], autoReconnect = true, debugName = null) +// debugName is used for console logs. If omitted socketAddress will be used instead. let socket = SmartWebSocket("ws://127.0.0.1:8080", [], true, "sock"); +socket.url = "ws://127.0.0.1:8081"; +socket.protocols = []; +socket.debugName = "mySock"; + // close if connection is open, then re-open connection +// applies changes to socket.url and socket.protocols socket.reconnect() -// close socket and disable auto-reconnect -socket.close() +// internal WebSocket element. +console.log(socket.socket); // is socket connection open if (socket.isReady()) { @@ -35,4 +41,7 @@ socket.on("anotherEvent", (data) => { socket.on("open", (event) => { console.log(event); }); + +// close socket and disable auto-reconnect +socket.close() ``` \ No newline at end of file