Skip to content

Commit 6efebcd

Browse files
authored
change publish API signature (#42)
1 parent 817e73e commit 6efebcd

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

lib/session.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,14 @@ export class Session {
274274

275275
async publish(
276276
topic: string,
277-
publishOptions: {
278-
args?: any[] | null,
279-
kwargs?: { [key: string]: any } | null,
280-
options?: { [key: string]: any } | null
281-
} = {}
277+
args?: any[] | null,
278+
kwargs?: { [key: string]: any } | null,
279+
options?: { [key: string]: any } | null
282280
): Promise<void | null> {
283-
const publish = new Publish(new PublishFields(
284-
this._nextID, topic, publishOptions.args, publishOptions.kwargs, publishOptions.options)
285-
);
281+
const publish = new Publish(new PublishFields(this._nextID, topic, args, kwargs, options));
286282

287283
this._baseSession.send(this._wampSession.sendMessage(publish));
288-
if (publishOptions.options?.["acknowledge"]) {
284+
if (options?.["acknowledge"]) {
289285
let promiseHandler: { resolve: () => void; reject: (reason: ApplicationError) => void; };
290286
const promise = new Promise<void>((resolve, reject) => {
291287
promiseHandler = {resolve, reject};

tests/interoptests/interop.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("WAMP Tests", function () {
6464
await subscriber.subscribe("io.xconn.test", eventHandler);
6565

6666
const publisher = await client.connect(url, REALM);
67-
await publisher.publish("io.xconn.test", {args: args, options: {"acknowledge": true}});
67+
await publisher.publish("io.xconn.test", args, {}, {"acknowledge": true});
6868

6969
await subscriber.close();
7070
await publisher.close();

0 commit comments

Comments
 (0)