Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
usp-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebSDK
usp-js
Commits
4b15ac47
Commit
4b15ac47
authored
1 year ago
by
Marin Karamihalev
Browse files
Options
Downloads
Patches
Plain Diff
added cleanSession option, defaults to false, set clientId to fromId
parent
61cf7adb
Branches
client-d
No related tags found
No related merge requests found
Pipeline
#119000
passed
1 year ago
Stage: install
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
package.json
+1
-1
1 addition, 1 deletion
package.json
src/configurations/mqtt.ts
+10
-2
10 additions, 2 deletions
src/configurations/mqtt.ts
src/types.ts
+4
-0
4 additions, 0 deletions
src/types.ts
with
15 additions
and
3 deletions
package.json
+
1
−
1
View file @
4b15ac47
{
{
"name"
:
"usp-js"
,
"name"
:
"usp-js"
,
"version"
:
"0.4.
7
"
,
"version"
:
"0.4.
8
"
,
"description"
:
"Library for easy usp(TR-369) communication using mqtt or ws."
,
"description"
:
"Library for easy usp(TR-369) communication using mqtt or ws."
,
"main"
:
"node/index.js"
,
"main"
:
"node/index.js"
,
"browser"
:
"web/index.js"
,
"browser"
:
"web/index.js"
,
...
...
This diff is collapsed.
Click to expand it.
src/configurations/mqtt.ts
+
10
−
2
View file @
4b15ac47
...
@@ -16,8 +16,15 @@ import { jsonRoots } from "./util";
...
@@ -16,8 +16,15 @@ import { jsonRoots } from "./util";
export
const
isURL
=
(
opts
:
ConnectionOptions
):
opts
is
URLConnectionOptions
=>
export
const
isURL
=
(
opts
:
ConnectionOptions
):
opts
is
URLConnectionOptions
=>
"
url
"
in
opts
;
"
url
"
in
opts
;
export
const
connectClient
:
ConnectClientFn
=
async
(
opts
)
=>
const
correctOptions
=
(
opts
:
ConnectionOptions
):
ConnectionOptions
=>
({
isURL
(
opts
)
...
opts
,
clientId
:
opts
.
clientId
||
opts
.
fromId
,
clean
:
opts
.
cleanSession
??
false
,
});
export
const
connectClient
:
ConnectClientFn
=
async
(
initialOpts
)
=>
{
const
opts
=
correctOptions
(
initialOpts
);
return
isURL
(
opts
)
?
(
mqttAsync
.
connectAsync
(
?
(
mqttAsync
.
connectAsync
(
opts
.
url
,
opts
.
url
,
opts
as
any
opts
as
any
...
@@ -31,6 +38,7 @@ export const connectClient: ConnectClientFn = async (opts) =>
...
@@ -31,6 +38,7 @@ export const connectClient: ConnectClientFn = async (opts) =>
:
{}),
:
{}),
}
as
any
)
as
unknown
as
ConnectionClient
)
}
as
any
)
as
unknown
as
ConnectionClient
)
:
(
mqttAsync
.
connectAsync
(
opts
)
as
unknown
as
ConnectionClient
);
:
(
mqttAsync
.
connectAsync
(
opts
)
as
unknown
as
ConnectionClient
);
};
export
const
loadProtobuf
=
async
(
version
:
USPVersion
):
Promise
<
Proto
>
=>
{
export
const
loadProtobuf
=
async
(
version
:
USPVersion
):
Promise
<
Proto
>
=>
{
const
[
rootRecordJson
,
rootMsgJson
]
=
jsonRoots
[
version
];
const
[
rootRecordJson
,
rootMsgJson
]
=
jsonRoots
[
version
];
...
...
This diff is collapsed.
Click to expand it.
src/types.ts
+
4
−
0
View file @
4b15ac47
...
@@ -765,6 +765,10 @@ export interface MainConnectionOptions {
...
@@ -765,6 +765,10 @@ export interface MainConnectionOptions {
*/
*/
connectTimeout
?:
number
;
connectTimeout
?:
number
;
clientId
?:
string
;
clientId
?:
string
;
/**
* Defaults to false
*/
cleanSession
?:
boolean
;
/**
/**
* Allows passing additional options to the underlying connection library
* Allows passing additional options to the underlying connection library
*/
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment