-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement dxb over http, goodbye messages, improve endpoint online de…
…tection
- Loading branch information
Showing
7 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Send DATEX blocks to a server with a HTTPComInterface | ||
* (listening to POST requests on /datex-http). | ||
* No response is returned. | ||
* | ||
* This is not the same as datex-over-http implemented in UIX | ||
* that send unsigned/unencrypted DATEX scripts to an HTTP server | ||
*/ | ||
export function sendDatexViaHTTPChannel(dxb: ArrayBuffer, origin = window.location.origin) { | ||
|
||
// fallback to sendBeacon for firefox until fetch keepalive implemented | ||
if (navigator.userAgent.includes("Firefox/")) { | ||
navigator.sendBeacon(origin + "/datex-http", dxb); | ||
} | ||
else { | ||
fetch(origin + "/datex-http", { | ||
method:'post', | ||
headers:{ | ||
'Content-Type': 'application/datex', | ||
}, | ||
body: dxb, | ||
keepalive: true | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters