Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added message for socket connection #2248

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,25 @@
const ws = new WebSocket('wss://staging.stakwork.com/cable?channel=ProjectLogChannel')

ws.onopen = () => {
console.log('WebSocket connection established')

Check warning on line 244 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / craco-build-run

Unexpected console statement

Check warning on line 244 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement
}

ws.onmessage = (event) => {
console.log('Message from server:', event.data)

Check warning on line 248 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / craco-build-run

Unexpected console statement

Check warning on line 248 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement

let id = 'a'

id = '51998781'

const command = {
command: 'subscribe',
identifier: JSON.stringify({ channel: 'ProjectLogChannel', id }),
}

// Send the command as a JSON string
ws.send(JSON.stringify(command))

console.log('Subscription command sent:', command)

Check warning on line 262 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / craco-build-run

Unexpected console statement

Check warning on line 262 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement
// Handle the message from the server here
}

Expand All @@ -254,7 +268,7 @@
}

ws.onclose = () => {
console.log('WebSocket connection closed')

Check warning on line 271 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / craco-build-run

Unexpected console statement

Check warning on line 271 in src/components/App/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement
}

// Cleanup when the component is unmounted
Expand Down
Loading