SSE Session and examples

This commit is contained in:
2026-09-17 07:51:48 +00:00
committed by Kuldeep
parent e96ab6457b
commit 752cda0706
16 changed files with 2306 additions and 4 deletions
+17
View File
@@ -0,0 +1,17 @@
import { SSESession, type SSEvent } from '../source/sse-session/index.ts';
// Command: npx tsx ./sandbox/sandbox-price-oracle.ts
// Use the GP Price Oracle API
const url = 'https://oracles.generalprotocols.com/sse/v1/messages';
// Create our sse session
const sseSession = await SSESession.create(url);
// Create a message event handler
sseSession.on('message', (message: SSEvent) => {
console.log(message);
});
// Connect to the SSESession
await sseSession.connect();