Skip to content

Commit

Permalink
[Filing] Websocket - Pass auth via cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
meissadia committed Apr 13, 2023
1 parent 4ae6283 commit f62a075
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/filing/actions/listenForProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,17 @@ export default function listenForProgress() {

try {
console.log(`-- Attempting connection to ${socketType}://${wsBaseUrl}${wsProgressUrl}`)
document.cookie = 'X-Authorization-Token=' + AccessToken.get() + '; path=/';
socket = new WebSocket(`${socketType}://${wsBaseUrl}${wsProgressUrl}`)
} catch (e) {
console.log(`--- Connection to ${socketType}://${wsBaseUrl}${wsProgressUrl} failed!`)
error(e)
console.log('---')
}

socket.onopen = (event) => {
socket.onopen = () => {
console.log('-- Socket open! Sending Bearer token and then listening for Progress...')
dispatch(requestProcessingProgress())
socket.send(
JSON.stringify({
headers: {
Authorization: 'Bearer ' + AccessToken.get(),
},
})
)

// Keep connection alive by pinging server every 60s
keepSocketAlive = setInterval(() => {
Expand Down

0 comments on commit f62a075

Please sign in to comment.