Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ build/Release
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Build artifacts
tsconfig.tsbuildinfo

lib/

# Local toy file
Expand Down
2 changes: 1 addition & 1 deletion __mocks__/jmp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventEmitter } from "events";
import * as jmp from "jmp";
import * as jmp from "@runtimed/jmp";

class Socket extends EventEmitter {
throttle = false;
Expand Down
5 changes: 2 additions & 3 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from "../src";

import { EventEmitter } from "events";
import { Socket as _Socket } from "jmp";
import { Socket as _Socket } from "@runtimed/jmp";
import * as zmq from "zeromq";

type Socket = typeof _Socket &
Expand All @@ -36,7 +36,7 @@ class HokeySocket extends _Socket {
}

describe("createSocket", () => {
test("creates a JMP socket on the channel with identity", async done => {
test("creates a JMP socket on the channel", async done => {
const config = {
signature_scheme: "hmac-sha256",
key: "5ca1ab1e-c0da-aced-cafe-c0ffeefacade",
Expand All @@ -48,7 +48,6 @@ describe("createSocket", () => {

const socket = await createSocket("iopub", identity, config);
expect(socket).not.toBeNull();
expect(socket.identity).toBe(identity);
expect(socket.type).toBe(ZMQType.frontend.iopub);
socket.close();

Expand Down
165 changes: 91 additions & 74 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"spawnteract": "^5.0.1",
"ts-jest": "^25.2.1",
"typescript": "^3.8.3",
"zeromq": "^5.2.0"
"zeromq": "^6.5.0"
},
"dependencies": {
"@nteract/messaging": "^7.0.0",
"jmp": "^2.0.0",
"@runtimed/jmp": "^3.0.0",
"rxjs": "^6.3.3",
"uuid": "^7.0.0"
},
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Channels, JupyterMessage } from "@nteract/messaging";
import * as moduleJMP from "jmp";
import * as moduleJMP from "@runtimed/jmp";
import { fromEvent, merge, Observable, Subject, Subscriber } from "rxjs";
import { FromEventTarget } from "rxjs/internal/observable/fromEvent";
import { map, publish, refCount } from "rxjs/operators";
Expand Down Expand Up @@ -67,15 +67,14 @@ export const formConnectionString = (
*/
export const createSocket = (
channel: ChannelName,
identity: string,
_identity: string,
config: JupyterConnectionInfo,
jmp = moduleJMP
): Promise<moduleJMP.Socket> => {
const zmqType = ZMQType.frontend[channel];
const scheme = config.signature_scheme.slice("hmac-".length);

const socket = new jmp.Socket(zmqType, scheme, config.key);
socket.identity = identity;

const url = formConnectionString(config, channel);
return verifiedConnect(socket, url);
Expand Down
4 changes: 2 additions & 2 deletions types/jmp/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module "jmp" {
import zmq from "zeromq";
declare module "@runtimed/jmp" {
import zmq from "zeromq/v5-compat";

export interface MessageProperties {
idents: any[];
Expand Down
Loading