Skip to content

Commit

Permalink
further
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-forooghian committed Jun 5, 2024
1 parent b41e76a commit 423488a
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 31 deletions.
5 changes: 5 additions & 0 deletions docs/internal/private-api-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ Marked in code.

### `test/realtime/channel.test.js`

Marked in code.

- `var createPM = Ably.protocolMessageFromDeserialized;`
- `expect(channel.channelOptions).to.deep.equal(channelOptions, 'Check requested channel options');` (`channelOptions` isn’t public API)
- listens for `channel._allChannelChanges.on(['update'],`
Expand All @@ -101,7 +103,10 @@ Marked in code.

### `test/realtime/auth.test.js`

Marked in code.

- `var http = new Ably.Realtime._Http();` — just uses this as an HTTP client to fetch a JWT
- reads `realtime.auth.method` to check it’s `token`
- spies on `rest.time` to count how many times called
- checks `rest.serverTimeOffset`
- spies on `transport.send` to look for an outgoing `AUTH` and check its properties
Expand Down
28 changes: 20 additions & 8 deletions test/common/modules/private_api_recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,47 @@ define([], function () {
'call.Platform.nextTick',
'call.PresenceMessage.fromValues',
'call.Utils.mixin',
'call.Utils.toQueryString',
'call.channel.checkPendingState',
'call.channel.processMessage',
'call.channel.requestState',
'call.channel.sendPresence',
'call.channel.sync',
'call.connectionManager.onChannelMessage',
'call.http.doUri',
'call.msgpack.decode',
'call.msgpack.encode',
'call.presence._myMembers.put',
'call.presence.waitSync',
'call.protocolMessageFromDeserialized',
'call.realtime.connection.connectionManager.activeProtocol.getTransport',
'call.transport.onProtocolMessage',
'call.transport.send',
'listen.channel._allChannelChanges.attached',
'listen.channel._allChannelChanges.update',
'listen.connectionManager.transport.active',
'listen.connectionManager.transport.pending',
'pass.clientOption.webSocketConnectTimeout',
'read.Defaults.protocolVersion',
'read.EventEmitter.events',
'read.auth.authOptions.authUrl',
'read.auth.method',
'read.auth.tokenParams.version',
'read.channel.channelOptions',
'read.channel.channelOptions.cipher',
'read.connectionManager.connectionId',
'read.realtime.connection.connectionManager.activeProtocol.transport',
'read.rest.serverTimeOffset',
'replace.channel.attachImpl',
'replace.channel.processMessage',
'replace.channel.sendMessage',
'replace.channel.sendPresence',
'replace.connectionManager.onChannelMessage',
'replace.rest.time',
'replace.transport.onProtocolMessage',
'replace.transport.send',
'replace.channel.processMessage',
'write.channel._lastPayload',
'write.realtime.options.timeouts.realtimeRequestTimeout',
'pass.clientOption.webSocketConnectTimeout',
'read.realtime.connection.connectionManager.activeProtocol.transport',
'replace.transport.onProtocolMessage',
'call.transport.onProtocolMessage',
'replace.connectionManager.onChannelMessage',
'call.connectionManager.onChannelMessage',
'call.channel.requestState',
];

class PrivateApiRecorder {
Expand Down
Loading

0 comments on commit 423488a

Please sign in to comment.