|
3 | 3 |
|
4 | 4 | import axios, { AxiosRequestConfig, AxiosInstance, AxiosResponse } from 'axios'; |
5 | 5 | import https from 'https'; |
6 | | -import { v4 as uuidv4 } from 'uuid'; |
7 | 6 | import WebSocket from 'isomorphic-ws'; |
| 7 | + |
8 | 8 | import { Channel } from './channel'; |
9 | 9 | import { ClientState } from './client_state'; |
10 | 10 | import { StableWSConnection } from './connection'; |
11 | 11 | import { isValidEventType } from './events'; |
12 | 12 | import { JWTUserToken, DevToken, CheckSignature } from './signing'; |
13 | 13 | import { TokenManager } from './token_manager'; |
14 | | -import { isFunction, addFileToFormData, chatCodes, normalizeQuerySort } from './utils'; |
| 14 | +import { |
| 15 | + isFunction, |
| 16 | + addFileToFormData, |
| 17 | + chatCodes, |
| 18 | + normalizeQuerySort, |
| 19 | + randomId, |
| 20 | +} from './utils'; |
15 | 21 |
|
16 | 22 | import { |
17 | 23 | APIResponse, |
@@ -145,7 +151,6 @@ export class StreamChat< |
145 | 151 | user?: UserResponse<UserType>; |
146 | 152 | userAgent?: string; |
147 | 153 | userID?: string; |
148 | | - UUID?: string; |
149 | 154 | wsBaseURL?: string; |
150 | 155 | wsConnection: StableWSConnection<ChannelType, CommandType, UserType> | null; |
151 | 156 | wsPromise: ConnectAPIResponse<ChannelType, CommandType, UserType> | null; |
@@ -301,8 +306,7 @@ export class StreamChat< |
301 | 306 | } |
302 | 307 |
|
303 | 308 | _setupConnection = () => { |
304 | | - this.UUID = uuidv4(); |
305 | | - this.clientID = `${this.userID}--${this.UUID}`; |
| 309 | + this.clientID = `${this.userID}--${randomId()}`; |
306 | 310 | this.wsPromise = this.connect(); |
307 | 311 | this._startCleaning(); |
308 | 312 | return this.wsPromise; |
@@ -466,7 +470,7 @@ export class StreamChat< |
466 | 470 |
|
467 | 471 | setAnonymousUser = () => { |
468 | 472 | this.anonymous = true; |
469 | | - this.userID = uuidv4(); |
| 473 | + this.userID = randomId(); |
470 | 474 | const anonymousUser = { |
471 | 475 | id: this.userID, |
472 | 476 | anon: true, |
|
0 commit comments