-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
405 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = tab | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
quote_type = single | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[vcbuild.bat] | ||
end_of_line = crlf | ||
|
||
[Makefile] | ||
indent_size = 8 | ||
indent_style = tab | ||
|
||
[{deps}/**] | ||
charset = unset | ||
end_of_line = unset | ||
indent_size = unset | ||
indent_style = unset | ||
trim_trailing_whitespace = unset | ||
|
||
[{test/fixtures,deps,tools/node_modules,tools/gyp,tools/icu,tools/msvs}/**] | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Publish to NPM | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '14.x' | ||
cache: 'npm' | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: Install dependencies and build | ||
run: npm ci && npm run build | ||
|
||
- name: Publish package on NPM 📦 | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,52 @@ | ||
# botika-socket-http-node | ||
Node.js client to interact with the Botika Socket REST API | ||
# Botika Socket HTTP Node Library | ||
|
||
Node.js library for interacting with the Botika Socket HTTP API. | ||
|
||
## Installation | ||
|
||
You can get the Botika Socket PHP library via a npm package called `botika-socket`. See <https://www.npmjs.com/package/botika-socket> | ||
|
||
```bash | ||
npm i botika-socket | ||
``` | ||
|
||
## Botika Socket constructor | ||
|
||
Use the credentials from your Botika Socket application to create a new instance. | ||
|
||
```javascript | ||
import { Socket, Auth } from 'botika-socket'; | ||
const baseURL = 'https://socket.example.com'; | ||
const auth = new Auth('username', 'password'); | ||
|
||
// Initialize socket | ||
const socket = new Socket(baseURL, auth); | ||
``` | ||
|
||
## Logging configuration | ||
|
||
```javascript | ||
const logger = require('pino')() | ||
|
||
socket.setLogger(logger); | ||
``` | ||
|
||
## Publishing/Triggering events | ||
|
||
To trigger an event on one or more channels use the `trigger` function. | ||
|
||
### A single channel | ||
|
||
```javascript | ||
// Options get from https://axios-http.com/docs/req_config | ||
const options = {}; | ||
socket.trigger('my-channel', 'my_event', 'hello world', options); | ||
``` | ||
|
||
### Multiple channels | ||
|
||
```javascript | ||
// Options get from https://axios-http.com/docs/req_config | ||
const options = {}; | ||
socket.trigger([ 'channel-1', 'channel-2' ], 'my_event', 'hello world', options); | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.