-
Notifications
You must be signed in to change notification settings - Fork 398
Expand file tree
/
Copy pathconfiguration.ts
More file actions
43 lines (36 loc) · 1.19 KB
/
configuration.ts
File metadata and controls
43 lines (36 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import PubNub from '../../src/web/index';
// snippet.configurationBasicUsageSubscriptionWorkerUrl
const pubnub = new PubNub({
subscribeKey: 'demo',
publishKey: 'demo',
userId: 'unique-user-id',
// using PubNub JS SDK v9.6.0, make sure the versions match.
// NOTE: 'subscriptionWorkerUrl' is only needed if you need to use SharedWorker.
subscriptionWorkerUrl: 'https://www.my-domain.com/static/js/pubnub.worker.9.6.0.js',
});
// snippet.end
// snippet.setAuthKeyBasicUsage
pubnub.setAuthKey('my_authkey');
// snippet.end
// snippet.setFilterExpressionBasicUsage
pubnub.setFilterExpression('such=wow');
// snippet.end
// snippet.getFilterExpressionBasicUsage
pubnub.getFilterExpression();
// snippet.end
// snippet.generateUUIDBasicUsage(deprecated)
PubNub.generateUUID();
// snippet.end
// snippet.configurationBasicUsage
// Initialize PubNub with your keys
const pubnubConfig = new PubNub({
subscribeKey: 'YOUR_SUBSCRIBE_KEY',
publishKey: 'YOUR_PUBLISH_KEY',
userId: 'YOUR_USER_ID',
cryptoModule: PubNub.CryptoModule?.aesCbcCryptoModule({ cipherKey: 'YOUR_CIPHER_KEY' }),
authKey: 'accessMangerToken',
logLevel: PubNub.LogLevel.Debug,
ssl: true,
presenceTimeout: 130,
});
// snippet.end