Skip to content

Commit

Permalink
Merge pull request #7 from raph-son/zeromq-fix
Browse files Browse the repository at this point in the history
Fixed socket communication for windows
  • Loading branch information
jehna authored Dec 12, 2023
2 parents 0d7cc83 + b94501e commit 4dfe05e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/mq.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import os from 'os';

import zmq from "zeromq";
import { spawn } from "child_process";

const sock = zmq.socket("req");

sock.connect("ipc:///tmp/humanify-local-inference-server.ipc");
// Allow communication support for windows
if (os.platform() === 'win32') {
sock.connect("inproc:///tmp/humanify-local-inference-server.ipc");
} else {
sock.connect("ipc:///tmp/humanify-local-inference-server.ipc");
}

export function send<Recv extends {}>(message: Object) {
sock.send(JSON.stringify(message));
Expand Down

0 comments on commit 4dfe05e

Please sign in to comment.