fix comment websocket from connecting more than once per claim
This commit is contained in:
parent
6d89f0df7e
commit
0c71059bf0
1 changed files with 7 additions and 2 deletions
|
@ -9,6 +9,10 @@ let sockets = {};
|
|||
let closingSockets = {};
|
||||
let retryCount = 0;
|
||||
|
||||
const getCommentSocketUrl = (claimId) => {
|
||||
return `${COMMENT_WS_URL}${claimId}&category=${claimId}`;
|
||||
};
|
||||
|
||||
export const doSocketConnect = (url, cb) => {
|
||||
function connectToSocket() {
|
||||
if (sockets[url] !== undefined && sockets[url] !== null) {
|
||||
|
@ -88,7 +92,7 @@ export const doNotificationSocketConnect = (enableNotifications) => (dispatch) =
|
|||
};
|
||||
|
||||
export const doCommentSocketConnect = (uri, claimId) => (dispatch) => {
|
||||
const url = `${COMMENT_WS_URL}${claimId}&category=${claimId}`;
|
||||
const url = getCommentSocketUrl(claimId);
|
||||
|
||||
doSocketConnect(url, (response) => {
|
||||
if (response.type === 'delta') {
|
||||
|
@ -102,6 +106,7 @@ export const doCommentSocketConnect = (uri, claimId) => (dispatch) => {
|
|||
};
|
||||
|
||||
export const doCommentSocketDisconnect = (claimId) => (dispatch) => {
|
||||
const url = `${COMMENT_WS_URL}${claimId}`;
|
||||
const url = getCommentSocketUrl(claimId);
|
||||
|
||||
dispatch(doSocketDisconnect(url));
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue