
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@solana/rpc-subscriptions-channel-websocket
Advanced tools
An RPC Subscriptions transport that uses WebSockets
This package allows developers to create custom RPC Subscriptions channels. Using these primitives, developers can create custom channels that perform transforms on messages sent and received, perform autopings, and implement custom channel pooling strategies.
createWebSocketChannel()Creates an object that represents an open channel to a WebSocket server.
You can use it to send messages by calling its send() function and you can receive them by subscribing to the RpcSubscriptionChannelEvents it emits.
import { createWebSocketChannel } from '@solana/rpc-subscriptions-channel-websocket';
const abortController = new AbortController();
const webSocketChannel = await createWebSocketChannel({
sendBufferHighWatermark: Number.POSITIVE_INFINITY,
signal: abortController.signal,
url: 'wss://api.mainnet-beta.solana.com',
});
const channel = {
...webSocketChannel,
on(type, listener, options) {
if (type !== 'message') {
return webSocketChannel.on(type, listener, options);
}
return webSocketChannel.on(
'message',
function deserializingListener(message: string) {
const deserializedMessage = JSON.parse(message);
listener(deserializedMessage);
},
options,
);
},
send(message) {
const serializedMessage = JSON.stringify(message);
return webSocketChannel.send(serializedMessage);
},
} as RpcSubscriptionsChannel<unknown, unknown>;
channel.on(
'error',
e => {
console.log('Received error', e);
abortController.abort();
},
{ signal: abortController.signal },
);
channel.on(
'message',
m => {
console.log('Received message', m);
abortController.abort();
},
{ signal: abortController.signal },
);
await channel.send({ id: 1, jsonrpc: '2.0', method: 'getSlot' });
sendBufferHighWatermarkThe number of bytes to admit into the WebSocket's send buffer before queueing messages on the client.
When you call send() on a WebSocket the runtime might add the message to a buffer rather than send it right away. In the event that socket.bufferedAmount exceeds the value configured here, messages will be added to a queue in your application code instead of being sent to the WebSocket, until such time as the bufferedAmount falls back below the high watermark.
signalAn AbortSignal to fire when you want to explicitly close the WebSocket.
If the channel is open it will be closed with the code 1000, representing a normal closure. If the channel has not been established yet, firing this signal will result in the AbortError being thrown to the caller who was trying to open the channel.
urlA string representing the target endpoint. In Node, it must be an absolute URL using the ws or wss protocol.
FAQs
An RPC Subscriptions transport that uses WebSockets
The npm package @solana/rpc-subscriptions-channel-websocket receives a total of 355,338 weekly downloads. As such, @solana/rpc-subscriptions-channel-websocket popularity was classified as popular.
We found that @solana/rpc-subscriptions-channel-websocket demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.