10000 Add documentation for top level API in README · Intrising/arduinoWebSockets@210f2e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 210f2e8

Browse files
Philippe GuayPhilippe Guay
authored andcommitted
Add documentation for top level API in README
1 parent 34a2d28 commit 210f2e8

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,39 @@ a WebSocket Server and Client for Arduino based on RFC6455.
3131
- ATmega2560 with Ethernet Shield (ATmega branch)
3232
- ATmega2560 with enc28j60 (ATmega branch)
3333

34+
##### High Level API #####
35+
36+
- `begin` : Initiate connection sequence to the websocket host.
37+
```
38+
void begin(const char *host, uint16_t port, const char * url = "/", const char * protocol = "arduino");
39+
void begin(String host, uint16_t port, String url = "/", String protocol = "arduino");
40+
```
41+
- `onEvent`: Callback to handle for websocket events
42+
43+
```
44+
void onEvent(WebSocketClientEvent cbEvent);
45+
```
46+
47+
- `WebSocketClientEvent`: Handler for websocket events
48+
```
49+
void (*WebSocketClientEvent)(WStype_t type, uint8_t * payload, size_t length)
50+
```
51+
Where `WStype_t type` is defined as:
52+
```
53+
typedef enum {
54+
WStype_ERROR,
55+
WStype_DISCONNECTED,
56+
WStype_CONNECTED,
57+
WStype_TEXT,
58+
WStype_BIN,
59+
WStype_FRAGMENT_TEXT_START,
60+
WStype_FRAGMENT_BIN_START,
61+
WStype_FRAGMENT,
62+
WStype_FRAGMENT_FIN,
63+
} WStype_t;
64+
```
65+
66+
3467
###### Note: ######
3568

3669
version 2.0 and up is not compatible with AVR/ATmega, check ATmega branch.

0 commit comments

Comments
 (0)
0