Skip to content
Snippets Groups Projects
Commit 4bdae76b authored by Marin Karamihalev's avatar Marin Karamihalev
Browse files

Merge branch 'genx' of dev.iopsys.eu:iopsys/usp-js into genx

parents 7af51ee4 edbbc3b8
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ const defaultPublishEndpoint = "/usp/endpoint";
const defaultSubscribeEndpoint = "/usp/controller";
const defaultIdEndpoint = "obuspa/EndpointID";
const defaultFromId = "proto::interop-usp-controller";
const defaultConnectionTimeout = 5000;
const idResolveTimeout = 5000;
const fixId = (s: string) => s.split("+").join("%2B");
......
......@@ -16,6 +16,7 @@ const isURL = (opts: ConnectionOptions): opts is URLConnectionOptions =>
"url" in opts;
const connectClient = (opts: ConnectionOptions): ConnectionClient => {
console.log({ opts })
if (isURL(opts))
return mqttAsync.connectAsync(
opts.url,
......@@ -24,9 +25,9 @@ const connectClient = (opts: ConnectionOptions): ConnectionClient => {
else
return opts.protocol?.startsWith("ws")
? (mqttAsync.connectAsync(
`${opts.protocol}://${opts.host}:${opts.port}`,
opts as any
) as unknown as ConnectionClient)
`${opts.protocol}://${opts.host}:${opts.port}`,
opts as any
) as unknown as ConnectionClient)
: (mqttAsync.connectAsync(opts) as unknown as ConnectionClient);
};
......
......@@ -450,6 +450,7 @@ export interface OtherConnectionOptions {
cert?: CertType;
closeOnDisconnect?: boolean;
reconnectsBeforeClosing?: number;
connectTimeout?: number;
}
export type ConnectionOptions = URLConnectionOptions | HostConnectionOptions;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment