Skip to content

Commit ee86e8b

Browse files
committed
Version 0.2; Updated ReadMe
1 parent ab02254 commit ee86e8b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,31 @@ conn.on('eventName', data => {
4242
console.log('Received event: ', data.eventName, 'with payload: ', data.payload)
4343
})
4444
```
45+
46+
**Listener for all events**
47+
48+
```javascript
49+
50+
All events will be sent to `message` listener even if there is another listener sent for those events.
51+
52+
conn.on('message', event => {
53+
console.log("onMessage received event: ",event)
54+
})
55+
```
56+
4557
**Send Events**
4658
47-
Only supports sending serialisable objects and strings now.
48-
Binary data support is in progress.
4959
5060
```javascript
5161
conn.send('eventName',{x:0,y:0})
5262
```
5363
64+
**Send Data**
65+
66+
```javascript
67+
conn.sendData('eventName',new Uint8Array())
68+
```
69+
5470
Client for browser is build on top of WebSocket javascript object. TFPSocketsClient provides access to base socket object via `ws` property and can also be initialised with a pre initialised WebSocket instance using:
5571
```javascript
5672
var cleint = new TFPSocketsClient(null, null,initilisedWS)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tfpsockets",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Simple event based websockets wrapper",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)