Skip to content

Commit

Permalink
Add presence parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoanand committed Sep 29, 2021
1 parent 0964134 commit 2c6e63b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Complete list of allowed configuration options
| consoleLogs | Logs useful connection info if set to `true` | `false` |
| notifySelf | Receive messages sent by self | `true` |
| jwt | JWT authentication token | `null` |
| presence | Enable presence events, pass 1 to enabled | `0` |


## Development
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "piesocket-js",
"version": "1.1.1",
"version": "1.1.2",
"description": "PieSocket Javascript Client",
"main": "src/index.js",
"unpkg": "dist/piesocket.js",
Expand Down
3 changes: 2 additions & 1 deletion src/PieSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const defaultOptions = {
consoleLogs: false,
notifySelf: true,
jwt: null,
presence: 0,
}

export default class PieSocket {
Expand Down Expand Up @@ -54,7 +55,7 @@ export default class PieSocket {
}

getEndpoint(channelId) {
let endpoint = `wss://${this.options.clusterId}.piesocket.com/v${this.options.version}/${channelId}?api_key=${this.options.apiKey}&notify_self=${this.options.notifySelf}&source=jssdk&v=${pjson.version}`
let endpoint = `wss://${this.options.clusterId}.piesocket.com/v${this.options.version}/${channelId}?api_key=${this.options.apiKey}&notify_self=${this.options.notifySelf}&source=jssdk&v=${pjson.version}&presence=${this.options.presence}`
if(this.options.jwt){
endpoint = endpoint+"&jwt="+this.options.jwt;
}
Expand Down

0 comments on commit 2c6e63b

Please sign in to comment.