-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: update examples according to the new API
PR-URL: #209 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com> Reviewed-By: Dmytro Nechai <nechaido@gmail.com>
- Loading branch information
1 parent
34cd6ee
commit a09dfe8
Showing
3 changed files
with
24 additions
and
18 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 |
---|---|---|
|
@@ -87,8 +87,8 @@ const app = new jstp.Application('testApp', { | |
// WebSocket and Unix domain sockets. One might notice that an array of | ||
// applications is passed the `createServer()`. That's because it can serve | ||
// any number of applications. | ||
const server = jstp.tcp.createServer(3000, [app]); | ||
server.listen(() => { | ||
const server = jstp.net.createServer([app]); | ||
server.listen(3000, () => { | ||
console.log('TCP server listening on port 3000 🚀'); | ||
}); | ||
``` | ||
|
@@ -100,15 +100,18 @@ Client: | |
|
||
const jstp = require('metarhia-jstp'); | ||
|
||
// Create a TCP client. Clients can have applications too for full-duplex RPC, | ||
// but we don't need that in this example. | ||
const client = jstp.tcp.createClient({ host: 'localhost', port: 3000 }); | ||
|
||
// Connect to the `testApp` application. Username and password are both `null` | ||
// Create a TCP connection to server and connect to the `testApp` application. | ||
// Clients can have applications too for full-duplex RPC, | ||
// but we don't need that in this example. Client is `null` in this example, | ||
// this implies that username and password are both `null` | ||
// here — that is, the protocol-level authentication is not leveraged in this | ||
// example. The next argument is an array of interfaces to inspect and build | ||
// remote proxy objects for. | ||
client.connectAndInspect('testApp', null, null, ['someService'], handleConnect); | ||
// remote proxy objects for. Remaining arguments are for | ||
// net.connect (host and port) and last argument is a callback | ||
// to be called on successful connection or error. | ||
const client = jstp.net.connectAndInspect( | ||
'testApp', null, ['someService'], 3000, 'localhost', handleConnect | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lundibundi
Author
Member
|
||
); | ||
|
||
function handleConnect(error, connection, app) { | ||
if (error) { | ||
|
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
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
Indentation is inconsistent here.
And can you please not reviewed-by tag me on commits I did not review and have never seen? Thanks.