improve README
This commit is contained in:
parent
76e0f99c6b
commit
2b326937ff
@ -1,11 +1,12 @@
|
|||||||
# smartsocket
|
# smartsocket
|
||||||
easy and secure websocket communication
|
easy and secure websocket communication, Typescript ready
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
[![build status](https://gitlab.com/pushrocks/smartsocket/badges/master/build.svg)](https://gitlab.com/pushrocks/smartsocket/commits/master)
|
[![build status](https://gitlab.com/pushrocks/smartsocket/badges/master/build.svg)](https://gitlab.com/pushrocks/smartsocket/commits/master)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
We recommend the use of typescript.
|
We recommend the use of typescript.
|
||||||
|
Under the hood we use socket.io and shortid for managed data exchange.
|
||||||
|
|
||||||
### Serverside
|
### Serverside
|
||||||
```typescript
|
```typescript
|
||||||
@ -50,7 +51,6 @@ let mySmartsocketClient = new smartsocket.SmartsocketClient({
|
|||||||
let mySocketFunction2 = new smartsocket.SocketFunction({
|
let mySocketFunction2 = new smartsocket.SocketFunction({
|
||||||
name:"restart",
|
name:"restart",
|
||||||
func:(data) => {}, the function to execute
|
func:(data) => {}, the function to execute
|
||||||
roles: [mySocketRole] // all roles that have access to a specific function
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mySmartsocketClient.registerFunction(mySocketFunction2);
|
mySmartsocketClient.registerFunction(mySocketFunction2);
|
||||||
@ -60,3 +60,5 @@ mySmartsocketClient.serverCall("newService",data)
|
|||||||
|
|
||||||
});;
|
});;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **NOTE:** you can easily chain dependent requests on eiter the server or client side with promises. `data` is always a js object that you can design for your specific. It supports buffers for large binary data network exchange.
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "smartsocket",
|
"name": "smartsocket",
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"description": "easy and secure websocket communication",
|
"description": "easy and secure websocket communication, Typescript ready",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -29,6 +29,7 @@
|
|||||||
"taskbuffer": "^1.0.7"
|
"taskbuffer": "^1.0.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"npmts-g": "^5.2.8",
|
||||||
"should": "^10.0.0",
|
"should": "^10.0.0",
|
||||||
"typings-test": "^1.0.1"
|
"typings-test": "^1.0.1"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user