From 354fdc668f94a3610e9c10ffecc65bf9368b18a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Obr=C3=A1til?= Date: Fri, 19 Dec 2014 23:28:52 +0100 Subject: [PATCH] Update README.md Added API documentation of socket state property --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d99f8bb..78416cb 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,12 @@ Invoked after connection close. Native resources are released after this handler #### `onError: (message: string) => void` Invoked when some error occurs during connection. +### Properties +#### `state: Socket.State` +Represents state of the socket. It can have three values represented by `Socket.State` enum: `Socket.State.CLOSED`, `Socket.State.OPENING` or `Socket.State.OPENED`. + +Initial state of socket is CLOSED. After open is called, it switches to OPENING. If it is successfuly opened, it goes to OPENED state. If opening fails, it goes back to CLOSE. When socket is closed (by the server or by calling close method), it goes to CLOSED as well. + ### Methods #### `open(host, port, onSuccess?, onError?): void` Establishes connection with the remote host.