فهرست منبع

Update README.md

Oleh 10 سال پیش
والد
کامیت
ad9a672ea7
1فایلهای تغییر یافته به همراه14 افزوده شده و 14 حذف شده
  1. 14 14
      README.md

+ 14 - 14
README.md

@@ -22,11 +22,11 @@
 ```
 ##### Set websocket connection url
 ```c
-  // Combined url: "ws://echo.websocket.org:80/"
-  rws_socket_set_scheme(_socket, "ws");
-  rws_socket_set_host(_socket, "echo.websocket.org");
-  rws_socket_set_port(_socket, 80);
-  rws_socket_set_path(_socket, "/");
+// Combined url: "ws://echo.websocket.org:80/"
+rws_socket_set_scheme(_socket, "ws");
+rws_socket_set_host(_socket, "echo.websocket.org");
+rws_socket_set_port(_socket, 80);
+rws_socket_set_path(_socket, "/");
 ```
 ##### Set websocket responce callbacks
 Warning: ```rws_socket_set_on_disconnected``` is required
@@ -53,26 +53,26 @@ static void on_socket_received_text(rws_socket socket, const char * text, const
 }
 ..................
 // Set socket callbacks
-  rws_socket_set_on_disconnected(_socket, &on_socket_disconnected); // required
-  rws_socket_set_on_connected(_socket, &on_socket_connected);
-  rws_socket_set_on_received_text(_socket, &on_socket_received_text);
+rws_socket_set_on_disconnected(_socket, &on_socket_disconnected); // required
+rws_socket_set_on_connected(_socket, &on_socket_connected);
+rws_socket_set_on_received_text(_socket, &on_socket_received_text);
 ```
 ##### Connect
 ```c
-  rws_socket_connect(_socket);
+rws_socket_connect(_socket);
 ```
 ##### Send message to websocket
 ```c
-  const char * example_text =
-    "{\"version\":\"1.0\",\"supportedConnectionTypes\":[\"websocket\"],\"minimumVersion\":\"1.0\",\"channel\":\"/meta/handshake\"}";
-  rws_socket_send_text(_socket, example_text);
+const char * example_text =
+  "{\"version\":\"1.0\",\"supportedConnectionTypes\":[\"websocket\"],\"minimumVersion\":\"1.0\",\"channel\":\"/meta/handshake\"}";
+rws_socket_send_text(_socket, example_text);
 ```
 ##### Disconnect or delete websocket object
 Since socket can be connected and we need to send disconnect mesage, not just lazy close, need to wait and than delete object.
 Thats why just call ```rws_socket_disconnect```, its thread safe, and forget about this socket object.
 ```c
-  rws_socket_disconnect(_socket);
-  _socket = NULL;
+rws_socket_disconnect(_socket);
+_socket = NULL;
 ```