From dc5366f740d1064e4099ad58b0a26a80f3785bef Mon Sep 17 00:00:00 2001 From: Twiddly Date: Fri, 16 Dec 2022 17:32:56 +0100 Subject: [PATCH] update docs; --- README.md | 193 ------------------------------------------------------ 1 file changed, 193 deletions(-) diff --git a/README.md b/README.md index 495f508..410a282 100644 --- a/README.md +++ b/README.md @@ -76,199 +76,6 @@ log.logger = { Due to a [change](https://github.com/nodejs/node/issues/40702) in NodeJS v17, `localhost` might now return a IPV6 address. To restore previous behaviour of always preferring the IPV4 address, `Client.resolve_IPV4_localhost` was added and set to `true` by default. -### Classes - -
-
Client
-

A class representing a HappyPanda X client

-
- -### Functions - -
-
finalize(msg_dict, session_id, name, error, opts, msg_id)ServerMsg | string | Buffer
-

A helper function that will wrap your message up like this:

-
msg = {
-     'session': session_id,
-     'name': name,
-     'data': data, # <--- your message is put here
-  }
-
-
- - - -### Client - -

A class representing a HappyPanda X client

- -**Kind**: global class - -- [Client](#Client) - - [new Client(params)](#new_Client_new) - - [.alive()](#Client+alive) ⇒ boolean - - [.ready()](#Client+ready) ⇒ boolean - - [.set_server(host, port)](#Client+set_server) - - [.is_connected()](#Client+is_connected) ⇒ boolean - - [.close()](#Client+close) ⇒ Promise - - _async_ - - [.handshake(params)](#Client+handshake) ⇒ Promise - - [.request_auth(ignore_err)](#Client+request_auth) ⇒ Promise - - [.connect(params)](#Client+connect) ⇒ Promise - - [.send(msg)](#Client+send) ⇒ Promise - - [.send_raw(msg)](#Client+send_raw) ⇒ Promise - - - -#### new Client(params) - -| Param | Type | Default | Description | -| ------------------- | -------------------- | ---------------------------------- | -------------------------- | -| params | Object | |

optional params

| -| [params.name] | string | "js-client" |

name of client

| -| [params.host] | string | |

server host

| -| [params.port] | integer | |

server port

| -| [params.user] | string | |

username

| -| [params.password] | string | |

password

| -| [params.session_id] | string | |

a server session id

| -| [params.timeout] | integer | |

connection timeout

| - - - -#### client.alive() ⇒ boolean - -

Check if server is still alive

- -**Kind**: instance method of [Client](#Client) - - -#### client.ready() ⇒ boolean - -

Check if client is ready to exchange messages with server

- -**Kind**: instance method of [Client](#Client) - - -#### client.set_server(host, port) - -

Set server address

- -**Kind**: instance method of [Client](#Client) - -| Param | Type | Description | -| ----- | -------------------- | ------------------ | -| host | string |

server host

| -| port | integer |

server port

| - - - -#### client.is_connected() ⇒ boolean - -

Check if the client is still connected to the server

- -**Kind**: instance method of [Client](#Client) - - -#### client.close() ⇒ Promise - -

Close the connection

- -**Kind**: instance method of [Client](#Client) - - -#### client.handshake(params) ⇒ Promise - -

Perfom a handshake with the HPX server

- -**Kind**: instance method of [Client](#Client) -**Category**: async -**Throws**: - -- AuthError - -| Param | Type | Description | -| ------------------- | -------------------- | --------------------- | -| params | object |

optinal params

| -| [params.user] | string |

username

| -| [params.password] | integer |

password

| -| [params.ignore_err] | boolean |

ignore error

| - - - -#### client.request_auth(ignore_err) ⇒ Promise - -

Basically a re-login

- -**Kind**: instance method of [Client](#Client) -**Category**: async - -| Param | Type | Description | -| ---------- | -------------------- | ------------------- | -| ignore_err | boolean |

ignore error

| - - - -#### client.connect(params) ⇒ Promise - -

Connect to HPX server

- -**Kind**: instance method of [Client](#Client) -**Category**: async - -| Param | Type | Description | -| ------------- | -------------------- | ---------------------- | -| params | object |

optional params

| -| [params.host] | string |

server host

| -| [params.port] | integer |

server port

| - - - -#### client.send(msg) ⇒ Promise - -

Like [send_raw](send_raw), but as a convenience, this method will wrap your message into the required message structure HPX expects and automatically sets the session and name

- -**Kind**: instance method of [Client](#Client) -**Category**: async -**Fullfil**: Object - message from server - -| Param | Type | Description | -| ----- | ------------------ | ----------------------------------- | -| msg | Array |

this is an array of Object's

| - - - -#### client.send_raw(msg) ⇒ Promise - -

Send json-compatible Object to server. Receive json-compatible Object from server.

-

Note that this method will not modify your message and expects you to add the name and session yourself. See the [finalize](#finalize) function.

- -**Kind**: instance method of [Client](#Client) -**Category**: async -**Fullfil**: Object - message from server - -| Param | Type | Description | -| ----- | ------------------- | ------------------------------------ | -| msg | Object |

message to send to the server

| - - - -### finalize(msg_dict, session_id, name, error, opts, msg_id) ⇒ ServerMsg \| string \| Buffer - -

A helper function that will wrap your message up like this:

-
msg = {
-     'session': session_id,
-     'name': name,
-     'data': data, # <--- your message is put here
-  }
-
- -**Kind**: global function - -| Param | Type | Description | -PS D:\Code\happypandax\js-client> yarn docs -yarn run v1.22.10 -$ jsdoc2md --configure ./jsdoc2md.json --heading-depth 4 ./src/index.ts - #### Classes