@ombori/ga-messaging
Advanced tools
Comparing version 2.19.2 to 2.63.2
@@ -6,2 +6,13 @@ # Change Log | ||
## [2.63.2](https://github.com/ombori/gridapp/compare/v2.63.1...v2.63.2) (2021-06-07) | ||
### Bug Fixes | ||
* ga-messaging supports heartbeat ([92e7e48](https://github.com/ombori/gridapp/commit/92e7e485bd923b491b44790b509ce6ace007fbf2)) | ||
## [2.19.2](https://github.com/ombori/gridapp/compare/v2.19.1...v2.19.2) (2020-12-01) | ||
@@ -8,0 +19,0 @@ |
@@ -5,3 +5,5 @@ export declare type Message = { | ||
}; | ||
export declare const usePublish: () => (message: Message) => void; | ||
export declare const usePublish: () => (message: Message | string, payload: { | ||
[name: string]: any; | ||
} | undefined) => void; | ||
export declare const useSubscribe: (type: string, callback?: (msg: Message) => void, deps?: any[]) => void; | ||
@@ -11,3 +13,5 @@ export declare const setSpaceId: (spaceId: string) => void; | ||
declare const _default: { | ||
usePublish: () => (message: Message) => void; | ||
usePublish: () => (message: string | Message, payload: { | ||
[name: string]: any; | ||
} | undefined) => void; | ||
useSubscribe: (type: string, callback?: (msg: Message) => void, deps?: any[]) => void; | ||
@@ -14,0 +18,0 @@ setSpaceId: (spaceId: string) => void; |
@@ -0,1 +1,12 @@ | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
import React from 'react'; | ||
@@ -23,6 +34,17 @@ var RECONNECT_TIMEOUT = 10000; | ||
}; | ||
var send = function (message) { | ||
setInterval(function () { | ||
if (socket && socket.readyState == socket.OPEN) { | ||
send('App.Heartbeat', {}); | ||
} | ||
}, 30000); | ||
var send = function (message, payload) { | ||
try { | ||
console.log('broadcasting', message); | ||
socket.send(JSON.stringify(message)); | ||
if (payload) { | ||
console.log('broadcasting', message, payload); | ||
socket.send(JSON.stringify(__assign({ type: message }, payload))); | ||
} | ||
else { | ||
console.log('broadcasting', message); | ||
socket.send(JSON.stringify(message)); | ||
} | ||
} | ||
@@ -29,0 +51,0 @@ catch (e) { |
{ | ||
"name": "@ombori/ga-messaging", | ||
"version": "2.19.2", | ||
"version": "2.63.2", | ||
"main": "dist/index.js", | ||
@@ -16,3 +16,3 @@ "license": "UNLICENSED", | ||
}, | ||
"gitHead": "db5b507c532a8078f0fcee1ef852f7654f8b0ad2" | ||
"gitHead": "65ddb906e406375133561695b86728850cb6eff7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11843
263