Added lognpolling in signalR request
This commit is contained in:
parent
4cf3b391db
commit
369343f1d5
@ -10,20 +10,21 @@ let connection = null;
|
|||||||
const targetPath = "";
|
const targetPath = "";
|
||||||
|
|
||||||
export function startSignalR(loggedUser) {
|
export function startSignalR(loggedUser) {
|
||||||
console.log(loggedUser?.employeeInfo.id);
|
var jwtToken = localStorage.getItem("jwtToken");
|
||||||
|
console.log("token", jwtToken);
|
||||||
connection = new signalR.HubConnectionBuilder()
|
connection = new signalR.HubConnectionBuilder()
|
||||||
.withUrl(`${base_Url}/hubs/marco`, {
|
.withUrl(`${base_Url}/hubs/marco`, {
|
||||||
accessTokenFactory: () => localStorage.getItem("jwtToken"),
|
accessTokenFactory: () => jwtToken,
|
||||||
|
transport: signalR.HttpTransportType.LongPolling,
|
||||||
withCredentials: false,
|
withCredentials: false,
|
||||||
})
|
})
|
||||||
.withAutomaticReconnect()
|
.withAutomaticReconnect()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
connection.on("Attendance", (data) => {
|
connection.on("Attendance", (data) => {
|
||||||
clearCacheKey("Attendance");
|
clearCacheKey("Attendance");
|
||||||
if (data.loginUserId != loggedUser?.employeeInfo.id) {
|
if (data.loginUserId != loggedUser?.employeeInfo.id) {
|
||||||
eventBus.emit('attendance', data );
|
eventBus.emit("attendance", data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user