It is now required to provide userID parameter while configuring PubNub object. Previously, not setting the parameter by developers resulted in SDKs generating random userIDs every time a connection was created to PubNub. This, in turn, affected usage metrics, billing and Presence features.
Currently, updated SDKs would return an error indicating missing parameter, in case it had not been set.
Setting userID
Examples below show how you can set userID in Javascript SDK.
- Instantiating PubNub instance:
var pubnub = new PubNub({
subscribeKey: "mySubscribeKey",
publishKey: "myPublishKey",
userId: "myUniqueUserId"
}), - Calling a method to explicitly set it:
pubnub.setUserId(string)
See also: Users and Devices
In case of any questions, contact us at support@pubnub.com.