
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@jamsocket/socketio
Advanced tools
React hooks for interacting with socket.io servers in Jamsocket session backends.
React hooks for interacting with socket.io servers in Jamsocket session backends.
Read the docs here
npm install @jamsocket/socketio
Here's an example of how different parts of Jamsocket's client libraries work together.
import { Jamsocket } from '@jamsocket/server'
const jamsocket = new Jamsocket({
account: '[YOUR ACCOUNT]',
token: '[YOUR TOKEN]',
service: '[YOUR SERVICE]',
// during development, you can simply pass { dev: true }
})
const connectResponse = await jamsocket.connect() // returns an instance of ConnectResponse
import {
SessionBackendProvider, SocketIOProvider,
useEventListener, useSend, useReady
} from '@jamsocket/socketio'
function Root() {
return(
<SessionBackendProvider connectResponse={connectResponse}>
<SocketIOProvider url={connectResponse.url}>
<MyComponent />
</SocketIOProvider>
</SessionBackendProvider>
)
}
function MyComponent() {
const ready = useReady()
const sendEvent = useSend()
useEffect(() => {
if (ready) {
sendEvent('some-event', someValue)
}
}, [ready])
useEventListener('another-event', (args) => {
// do something when receiving an event message from your session backend...
})
}
SocketIOProviderThe SocketIOProvider uses the url returned from the connect function to connect to a SocketIO server running in your session backend.
Using the SocketIOProvider lets you use the React hooks in @jamsocket/socketio. It must be used in conjunction with @jamsocket/server and @jamsocket/react in order to properly access the session backend.
The SocketIOProvider must be a child of the SessionBackendProvider because it depends on the SessionBackendProvider's context.
import { SessionBackendProvider, type SpawnResult } from '@jamsocket/react'
import { SocketIOProvider } from '@jamsocket/socketio'
export default function HomeContainer({ connectResponse }: { connectResponse: ConnectResponse }) {
return (
<SessionBackendProvider connectResponse={connectResponse}>
<SocketIOProvider url={connectResponse.url}>
<Home />
</SocketIOProvider>
</SessionBackendProvider>
)
}
useSenduseSend lets you send events to the SocketIO server.
import { sendEvent } from '@jamsocket/socketio'
const sendEvent = useSend()
sendEvent('new-event', eventMessage)
useEventListeneruseEventListener lets you listen to events coming from the SocketIO server.
import { useEventListener } from '@jamsocket/socketio'
useEventListener<T>('event', (data: T) => {
// do something when a new event appears
})
The @jamsocket/socketio package also re-exports all of the @jamsocket/client, @jamsocket/react, and @jamsocket/types packages' exports, including their React providers, hooks, classes, and types.
FAQs
React hooks for interacting with socket.io servers in Jamsocket session backends.
We found that @jamsocket/socketio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.