Skip to content

Commit

Permalink
Use ::$space as space channel suffix
Browse files Browse the repository at this point in the history
::$space is a channel tag and has special meaning within Ably, unlike the suffix `-space`.
  • Loading branch information
dpiatek committed Nov 9, 2023
1 parent a2b0d08 commit d8795c8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/channel-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The below channels are used by the Spaces library internally.

Each `Space` (as defined by the [`Space` class](https://sdk.ably.com/builds/ably/spaces/main/typedoc/classes/Space.html)) creates its own [Ably Channel](https://ably.com/docs/channels).

The channel name is defined by the `name` of the Space and takes the form: `${name}-space`. The full name of a `channel` belonging to a `Space` called 'slides' would therefore be `slides-space`.
The channel name is defined by the `name` of the Space and takes the form: `${name}::$space`. The full name of a `channel` belonging to a `Space` called 'slides' would therefore be `slides::$space`.

### Cursors

Expand Down
2 changes: 1 addition & 1 deletion src/Space.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Space', () => {

expect(channelSpy).toHaveBeenNthCalledWith(
1,
'test-space',
'test::$space',
expect.objectContaining({
params: expect.objectContaining({
agent: expect.stringContaining('spaces'),
Expand Down
3 changes: 1 addition & 2 deletions src/Space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import type { Subset, PresenceMember } from './utilities/types.js';

import { VERSION } from './version.js';

// Replace by ::$space when that channel tag will be available
const SPACE_CHANNEL_TAG = '-space';
const SPACE_CHANNEL_TAG = '::$space';

const SPACE_OPTIONS_DEFAULTS = {
offlineTimeout: 120_000,
Expand Down
2 changes: 1 addition & 1 deletion src/Spaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Spaces', () => {
expect(spy).toHaveBeenCalledTimes(1);
expect(spy).toHaveBeenNthCalledWith(
1,
'test-space',
'test::$space',
expect.objectContaining({
params: expect.objectContaining({
agent: expect.stringContaining('spaces'),
Expand Down

0 comments on commit d8795c8

Please sign in to comment.