Add sandbox and examples for SSE Session

This commit is contained in:
2026-07-20 03:45:11 +00:00
parent 65be9c7dee
commit 948a885987
2 changed files with 110 additions and 0 deletions

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();