-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: add connection API documentation #300
Conversation
doc/api/connection.md
Outdated
|
||
Don't call this constructor manually unless you use custom tranport. | ||
Recommended approach is to call `connect()` function provided by these modules: | ||
* `net` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc/api/connection.md
Outdated
* callback(error, sessionId) — callback function to invoke after the handshake | ||
is completed. | ||
* error: `Error`. | ||
* sessionId: `number`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ain't it a string? here
doc/api/connection.md
Outdated
#### connection.inspectInterface(interfaceName, callback) | ||
|
||
* interfaceName: `String` — name of an interface to inspect. | ||
* callback(error, proxy) — callback function to invoke after another side responds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...responds to the interface introspection?
doc/api/connection.md
Outdated
* callback(error, proxy) — callback function to invoke after another side responds | ||
interface introspection. | ||
* error: `Error`. | ||
* proxy: `RemoteProxy` — remote proxy to the interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remote proxy for the interface?
doc/api/connection.md
Outdated
|
||
* interfaceName: `String` — name of an interface. | ||
* eventName: `String` — name of an event. | ||
* args: `Array` — event arguments as an array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 'as an array' is redundant as we already have class written here.
doc/api/connection.md
Outdated
|
||
#### connection.stopHeartbeat() | ||
|
||
Stop sending heaarbeat messages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/heaarbeat/heartbeat/
doc/api/connection.md
Outdated
* event: `string` — name of an event. | ||
* handler(...args). | ||
|
||
Used to subscribe on this events: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to subscribe to the following events?
doc/api/connection.md
Outdated
* event: `string` — name of an event. | ||
* handler(...args). | ||
|
||
Used to subscribe on this events: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should also add mandatory event arguments?
doc/api/connection.md
Outdated
* event: `string` — name of an event. | ||
* handler(...args). | ||
|
||
Used to subscribe on this events: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the same style as in Connection
here and in other Transport
methods as this is just another class description. And in this place specifically, I think it's better to just state that Transport
must emit the following events and avoid describing on
method (Maybe just state that it has to be an EventEmitter
).
doc/api/connection.md
Outdated
* error: `Error`. | ||
* connection: `Connection` — established connection. | ||
|
||
Optional, `new SimpleConnectPolicy().connect` will be used if not provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a link for new SimpleConnectPolicy().connect as in the first comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bed0aa4
to
21c2c64
Compare
doc/api/connection.md
Outdated
### new Connection(transport, server, client) | ||
|
||
* transport: `Transport`. | ||
* server: `Server` — JSTP server instance, used only for server—side parts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't use em dash in word 'server-side', a hyphen must be used there.
doc/api/connection.md
Outdated
* server: `Server` — JSTP server instance, used only for server—side parts | ||
of connections (optional, but either server or client is required). | ||
* client: [`Client`](./client.md#object-client) — JSTP client instance, | ||
used only for client—side parts of connections (optional, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for 'client-side'.
doc/api/connection.md
Outdated
|
||
#### getTransport() | ||
|
||
* Returns: `Object`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this method return Transport
?
doc/api/simple-connect-policy.md
Outdated
|
||
## Class: SimpleConnectPolicy | ||
|
||
Simple generic connection provider. Used for user-side connection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it'll be better to replace 'user-side' with 'client-side'?
doc/api/tls.md
Outdated
`'name@version'` or `{ name, version }`, where version must be | ||
a valid semver range. | ||
* client: [`Client`](./client.md#object-client) — JSTP client instance, used | ||
only for client—side parts of connections (optional, but either server or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again dash instead of the hyphen in word 'client-side'.
doc/api/net.md
Outdated
`'name@version'` or `{ name, version }`, where version must be | ||
a valid semver range. | ||
* client: [`Client`](./client.md#object-client) — JSTP client instance, used | ||
only for client—side parts of connections (optional, but either server or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dash instead of the hyphen.
doc/api/net.md
Outdated
only for client—side parts of connections (optional, but either server or | ||
client is required). | ||
* options: `Object` — will be destructured and passed directly to connFactory. | ||
* callback(error, connection): — Optional callback that will be called when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a dash right next to a colon here, looks like the argument type provided in other cases is missing.
4db0e5f
to
6c4e17e
Compare
doc/api/simple-connect-policy.md
Outdated
* connection: [`Connection`](./connection.md#class-connection). | ||
|
||
Should send handshake message with appropriate credentials. You can get client | ||
object provided upon connection creation with connection.client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't 'connection.client' be written in a monospaced font?
doc/api/tls.md
Outdated
* client: [`Client`](./client.md#object-client) — JSTP client instance, used | ||
only for client-side parts of connections (optional, but either server or | ||
client is required). | ||
* options: `Object` — will be destructured and passed directly to connFactory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'connFactory' should probably be written in a monospaced font as well.
6c4e17e
to
a124871
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR-URL: #300 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
Landed in a5b5808. |
PR-URL: #300 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
PR-URL: #300 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
No description provided.