a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
105
fork

Configure Feed

Select the types of activity you want to include in your feed.

README.md

@atcute/xrpc-server-node#

Node.js WebSocket adapter for @atcute/xrpc-server.

npm install @atcute/xrpc-server-node

see the subscriptions section in the main package for usage details.

import * as http from 'node:http';
import { createRequestListener } from '@remix-run/node-fetch-server';
import { XRPCRouter } from '@atcute/xrpc-server';
import { createNodeWebSocket } from '@atcute/xrpc-server-node';

import { ComExampleSubscribe } from './lexicons/index.js';

const ws = createNodeWebSocket();
const router = new XRPCRouter({ websocket: ws.adapter });

router.addSubscription(ComExampleSubscribe.mainSchema, {
	async *handler({ params, signal }) {
		while (!signal.aborted) {
			yield {
				// ...
			};
		}
	},
});

const server = http.createServer(createRequestListener(router.fetch));
ws.injectWebSocket(server, router);

server.listen(3000, () => {
	console.log('listening on port 3000');
});