Skip to content

Commit 9637d74

Browse files
committed
Mention publish not broadcasting to sender
1 parent 84cf679 commit 9637d74

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/1.guide/3.peer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Leave a broadcast channel.
8080

8181
### `peer.publish(channel, message)`
8282

83-
broadcast a message to the channel.
83+
Broadcast a message to the channel. The peer that the publish is called on itself is excluded from the broadcast.
8484

8585
:read-more{to="/guide/pubsub"}
8686

@@ -108,7 +108,7 @@ To gracefully close the connection, use `peer.close()`.
108108
## Compatibility
109109

110110
| | [Bun][bun] | [Cloudflare][cfw] | [Cloudflare (durable)][cfd] | [Deno][deno] | [Node (ws)][nodews] | [Node (μWebSockets)][nodeuws] | [SSE][sse] |
111-
| --------------------------- | ---------- | ----------------- | --------------------------- | ------------ | ------------------- | ----------------------------- | ---------- |
111+
|-----------------------------|------------|-------------------|-----------------------------|--------------|---------------------|-------------------------------|------------|
112112
| `send()` ||||||||
113113
| `publish()` / `subscribe()` |||[^1] |[^1] |[^1] ||[^1] |
114114
| `close()` ||||||||

docs/1.guide/5.pubsub.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ icon: simple-icons:googlepubsub
44

55
# Pub / Sub
66

7-
crossws supports native pub-sub API integration. A [peer](/guide/peer) can be subscribed to a set of named channels using `peer.subscribe(<name>)`. Messages can be published to a channel using `peer.publish(<name>, <message>)`.
7+
crossws supports native pub-sub API integration. A [peer](/guide/peer) can be subscribed to a set of named channels using `peer.subscribe(<name>)`. Messages can be published to a channel using `peer.publish(<name>, <message>)`. When publishing to a channel, the peer that does the publish is excluded from the broadcast so it won't receive it's own message.
88

99
```js
1010
import { defineHooks } from "crossws";

0 commit comments

Comments
 (0)