Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-wasps-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"agents-sdk": patch
---

pass `cors:true` to `routeAgentRequest` to automatically use across domains
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"files": {
"ignoreUnknown": false,
"ignore": ["node_modules", "dist"]
"ignore": ["node_modules", "dist", ".wrangler"]
},
"formatter": {
"enabled": false,
Expand Down
11 changes: 11 additions & 0 deletions examples/cross-domain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Cross-Domain Communication Demo

A simple demo showing WebSocket and HTTP communication between a React client and Cloudflare Worker server, when running on different domains. tl;dr - make sure you pass `cors: true` to routeAgentRequest.

## Quick Start

Run the front end and agents server:

```bash
npm i && npm start
```
11 changes: 11 additions & 0 deletions examples/cross-domain/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>Test cross domain</title>
<link rel="stylesheet" href="/normalize.css" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/client.tsx"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions examples/cross-domain/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@cloudflare/agents-cross-domain",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "concurrently \"vite dev\" \"wrangler dev\" --kill-others"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "A simple demo showing WebSocket and HTTP communication between a React client and Cloudflare Worker server, when running on different domains."
}
Binary file added examples/cross-domain/public/favicon.ico
Binary file not shown.
Loading