|
1 | 1 | # enchannel-zmq-backend |
2 | | -[](https://github.com/nteract/enchannel-zmq-backend/releases) |
3 | | -[](https://github.com/nteract/enchannel/releases) |
4 | | -[](https://greenkeeper.io/) |
5 | | - |
6 | | -:warning: :warning: Moved to the [nteract/nteract monorepo](https://github.com/nteract/nteract/tree/master/packages/enchannel-zmq-backend) :warning: :warning: |
7 | 2 |
|
8 | 3 | [**Installation**](#installation) | [**Usage**](#usage) | |
9 | 4 | [**Contributors and developers**](#contributors-and-developers) | |
@@ -51,7 +46,13 @@ That's it. Functions for four channels; *simplicity in action*. |
51 | 46 |
|
52 | 47 | Prerequisite: [Node.js and npm](https://docs.npmjs.com/getting-started/installing-node) |
53 | 48 |
|
54 | | -`npm install enchannel-zmq-backend` |
| 49 | +You may use whichever package manager (`npm` or `yarn`) best suits your workflow. The `nteract` team internally uses `yarn`. |
| 50 | + |
| 51 | +```bash |
| 52 | +npm install enchannel-zmq-backend |
| 53 | +# OR |
| 54 | +yarn add enchannel-zmq-backend |
| 55 | +``` |
55 | 56 |
|
56 | 57 | ## Usage |
57 | 58 |
|
@@ -100,6 +101,43 @@ const channels = createChannels(identity, runtimeConfig) |
100 | 101 | const { shell, iopub, stdin, control } = channels; |
101 | 102 | ``` |
102 | 103 |
|
| 104 | +`enchannel-zmq-backend` also gives access to all of the `channels` via a |
| 105 | +single multipled channel exposed via `createMainChannel`. |
| 106 | + |
| 107 | +```javascript |
| 108 | +import { createMainChannel } from 'enchannel-zmq-backend'; |
| 109 | +``` |
| 110 | + |
| 111 | +Similar to the `createChannels` function, the `createMainChannel` function |
| 112 | +accepts both an identity and a runtime object. |
| 113 | + |
| 114 | +```javascript |
| 115 | +const channel = createMainChannel(identity, runtimeConfig); |
| 116 | +``` |
| 117 | + |
| 118 | +Messages that are sent via the mutliplexed channel need to define a `type` |
| 119 | +property that outlines which channel they should be sent under. |
| 120 | + |
| 121 | +```javascript |
| 122 | +const body = { |
| 123 | + header: { |
| 124 | + msg_id: `execute_9ed11a0f-707e-4f71-829c-a19b8ff8eed8`, |
| 125 | + username: "rgbkrk", |
| 126 | + session: "00000000-0000-0000-0000-000000000000", |
| 127 | + msg_type: "execute_request", |
| 128 | + version: "5.0" |
| 129 | + }, |
| 130 | + content: { |
| 131 | + code: 'print("woo")', |
| 132 | + silent: false, |
| 133 | + store_history: true, |
| 134 | + user_expressions: {}, |
| 135 | + allow_stdin: false |
| 136 | + } |
| 137 | +}; |
| 138 | +const message = { type: "shell", body }; |
| 139 | +``` |
| 140 | +
|
103 | 141 | `enchannel-zmq-backend` also offers four convenience functions to |
104 | 142 | easily create the messaging channels for `control`, `stdin`, `iopub`, |
105 | 143 | and `shell` : |
@@ -220,17 +258,17 @@ Then, fork and clone this repo: |
220 | 258 | ```bash |
221 | 259 | git clone https://github.com/nteract/enchannel-zmq-backend.git |
222 | 260 | cd enchannel-zmq-backend |
223 | | -npm install |
| 261 | +yarn |
224 | 262 | ``` |
225 | 263 |
|
226 | 264 | Develop! We welcome new and first time contributors. |
227 | 265 |
|
228 | 266 |
|
229 | 267 | ## Learn more about nteract |
230 | 268 |
|
231 | | -- Visit our website http://nteract.io/. |
| 269 | +- Visit our website https://nteract.io/. |
232 | 270 | - See our organization on GitHub https://github.com/nteract |
233 | | -- Join us on [Slack](http://slack.nteract.in/) if you need help or have |
| 271 | +- Join us on [Slack](https://slack.nteract.io/) if you need help or have |
234 | 272 | questions. If you have trouble creating an account, either |
235 | 273 | email [email protected] or post an issue on GitHub. |
236 | 274 |
|
|
0 commit comments