hs-cti.d.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. /*!
  2. - Name HS_CTI
  3. - FileName hs-cti
  4. - Version 1.0.9
  5. - JS Standard any
  6. - Author platformfe
  7. - Built on 2024/11/27 10:37:38
  8. - GitHub
  9. - Branch main
  10. - CommitID 987d86cd91cde7d1c235ad106d79fc92c305b8ff
  11. - CommitMessage fix: 修改socket地址
  12. */
  13. /**
  14. * Minimal `EventEmitter` interface that is molded against the Node.js
  15. * `EventEmitter` interface.
  16. */
  17. declare class EventEmitter<
  18. EventTypes extends EventEmitter.ValidEventTypes = string | symbol,
  19. // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
  20. Context extends any = any
  21. > {
  22. static prefixed: string | boolean
  23. /**
  24. * Return an array listing the events for which the emitter has registered
  25. * listeners.
  26. */
  27. eventNames(): Array<EventEmitter.EventNames<EventTypes>>
  28. /**
  29. * Return the listeners registered for a given event.
  30. */
  31. listeners<T extends EventEmitter.EventNames<EventTypes>>(
  32. event: T
  33. ): Array<EventEmitter.EventListener<EventTypes, T>>
  34. /**
  35. * Return the number of listeners listening to a given event.
  36. */
  37. listenerCount(event: EventEmitter.EventNames<EventTypes>): number
  38. /**
  39. * Calls each of the listeners registered for a given event.
  40. */
  41. emit<T extends EventEmitter.EventNames<EventTypes>>(
  42. event: T,
  43. ...args: EventEmitter.EventArgs<EventTypes, T>
  44. ): boolean
  45. /**
  46. * Add a listener for a given event.
  47. */
  48. on<T extends EventEmitter.EventNames<EventTypes>>(
  49. event: T,
  50. fn: EventEmitter.EventListener<EventTypes, T>,
  51. context?: Context
  52. ): this
  53. addListener<T extends EventEmitter.EventNames<EventTypes>>(
  54. event: T,
  55. fn: EventEmitter.EventListener<EventTypes, T>,
  56. context?: Context
  57. ): this
  58. /**
  59. * Add a one-time listener for a given event.
  60. */
  61. once<T extends EventEmitter.EventNames<EventTypes>>(
  62. event: T,
  63. fn: EventEmitter.EventListener<EventTypes, T>,
  64. context?: Context
  65. ): this
  66. /**
  67. * Remove the listeners of a given event.
  68. */
  69. removeListener<T extends EventEmitter.EventNames<EventTypes>>(
  70. event: T,
  71. fn?: EventEmitter.EventListener<EventTypes, T>,
  72. context?: Context,
  73. once?: boolean
  74. ): this
  75. off<T extends EventEmitter.EventNames<EventTypes>>(
  76. event: T,
  77. fn?: EventEmitter.EventListener<EventTypes, T>,
  78. context?: Context,
  79. once?: boolean
  80. ): this
  81. /**
  82. * Remove all listeners, or those of the specified event.
  83. */
  84. removeAllListeners(event?: EventEmitter.EventNames<EventTypes>): this
  85. }
  86. declare namespace EventEmitter {
  87. export interface ListenerFn<Args extends any[] = any[]> {
  88. (...args: Args): void
  89. }
  90. export interface EventEmitterStatic {
  91. new <
  92. EventTypes extends ValidEventTypes = string | symbol,
  93. Context = any
  94. >(): EventEmitter<EventTypes, Context>
  95. }
  96. /**
  97. * `object` should be in either of the following forms:
  98. * ```
  99. * interface EventTypes {
  100. * 'event-with-parameters': any[]
  101. * 'event-with-example-handler': (...args: any[]) => void
  102. * }
  103. * ```
  104. */
  105. export type ValidEventTypes = string | symbol | object
  106. export type EventNames<T extends ValidEventTypes> = T extends string | symbol
  107. ? T
  108. : keyof T
  109. export type ArgumentMap<T extends object> = {
  110. [K in keyof T]: T[K] extends (...args: any[]) => void
  111. ? Parameters<T[K]>
  112. : T[K] extends any[]
  113. ? T[K]
  114. : any[]
  115. }
  116. export type EventListener<
  117. T extends ValidEventTypes,
  118. K extends EventNames<T>
  119. > = T extends string | symbol
  120. ? (...args: any[]) => void
  121. : (
  122. ...args: ArgumentMap<Exclude<T, string | symbol>>[Extract<K, keyof T>]
  123. ) => void
  124. export type EventArgs<
  125. T extends ValidEventTypes,
  126. K extends EventNames<T>
  127. > = Parameters<EventListener<T, K>>
  128. export const EventEmitter: EventEmitterStatic
  129. }
  130. /** @enum LoggerLevels 日志输出等级 */
  131. declare enum LoggerLevels {
  132. error = 0,
  133. warn = 1,
  134. log = 2,
  135. debug = 3
  136. }
  137. declare global {
  138. interface Window {
  139. ctiLoggerLevel?: LoggerLevels;
  140. HS_CTI_CLIENT_ID?: string;
  141. }
  142. }
  143. /** @class Logger 通用的日志模块 */
  144. declare class Logger {
  145. private _level;
  146. private category;
  147. private label;
  148. constructor(level: LoggerLevels, category: string, label?: string);
  149. error(content: string): void;
  150. warn(content: string): void;
  151. log(content: string): void;
  152. debug(content: string): void;
  153. genericLog(levelToLog: LoggerLevels, content: string): void;
  154. private print;
  155. get level(): LoggerLevels;
  156. set level(newLevel: LoggerLevels);
  157. }
  158. /**
  159. * 默认 'test'
  160. * 'development': 本地(不上报服埋点只打印 log)
  161. * 'test': 测试
  162. * 'production': 生产
  163. */
  164. type ENV = 'development' | 'test' | 'production';
  165. /**
  166. * @enum {string} CTI 初始化场景
  167. * Manual: 手动外呼
  168. * Robot: 机器人外呼
  169. * Monitor: 监听
  170. * Predictive: 预测式外呼
  171. */
  172. declare enum Scene {
  173. Manual = "manual",
  174. Robot = "robot",
  175. Monitor = "monitor",
  176. Predictive = "predictive",
  177. Wechat = "wechat"
  178. }
  179. type ExcludeScene = Scene.Manual | Scene.Robot | Scene.Predictive;
  180. /**
  181. * @enum {string} CTI 监听场景
  182. * All: 不区分场景
  183. * Manual: 手动外呼
  184. * Robot: 机器人外呼
  185. * Predictive: 预测式外呼
  186. */
  187. declare enum MonitorScene {
  188. All = "all",
  189. Manual = "manual",
  190. Robot = "robot",
  191. Predictive = "predictive"
  192. }
  193. /**
  194. * @interface {} 初始化 SD_CTI 的基本参数
  195. * agent_id: 坐席 ID
  196. * saas_id: 主体标识,例如 'hongshan'
  197. */
  198. interface BaseOptions {
  199. agent_id: string;
  200. saas_id: string;
  201. }
  202. interface BaseHsCTIInitOptions extends BaseOptions {
  203. loggerLevel?: LoggerLevels;
  204. password: string;
  205. env: ENV;
  206. }
  207. interface HsCTIInitOptions extends BaseHsCTIInitOptions {
  208. scene: ExcludeScene;
  209. }
  210. interface RequiredHsCTIInitOptions extends BaseHsCTIInitOptions {
  211. scene: Scene.Monitor;
  212. monitorScene: MonitorScene;
  213. }
  214. /**
  215. * @interface {} 初始化 SD_CTI 需要的参数
  216. * loggerLevel: 日志等级
  217. * password: 临时的鉴权字符串,由业务方写死传进来
  218. * scene: CTI 初始化场景
  219. * monitorScene: 监听场景
  220. * env: 环境变量
  221. */
  222. /**
  223. * @enum {string} Socket 状态
  224. * Initial: 初始状态
  225. * Connecting: Socket 开始建立连接
  226. * Connected: Socket 建立连接成功
  227. * Ready: 向 IM 发送第一个上行 login 消息收到成功回调
  228. * Terminated: Socket 连接断开、各种 Socket 错误流转到本状态
  229. */
  230. declare enum SocketStatus {
  231. Initial = "Initial",
  232. Connecting = "Connecting",
  233. Connected = "Connected",
  234. Ready = "Ready",
  235. ReTry = "ReTry",
  236. Terminated = "Terminated"
  237. }
  238. /**
  239. * @enum {string} SIP 状态
  240. * Initial: 初始状态
  241. * Started: SIP 的 User Agent 创建成功
  242. * Connecting: SIP 底层 Socket 传输 TransportState.Connecting
  243. * Connected: SIP 底层 Socket 传输 TransportState.Connected
  244. * Ready: SIP Registerer 监听注册状态 RegistererState.Registered
  245. * Terminated: SIP Socket 断开、注册失败等各种错误、主动断开连接流转到本状态
  246. */
  247. declare enum SIPStatus {
  248. Initial = "Initial",
  249. Started = "Started",
  250. Connecting = "Connecting",
  251. Connected = "Connected",
  252. Ready = "Ready",
  253. ReTry = "ReTry",
  254. Terminated = "Terminated"
  255. }
  256. /**
  257. * @enum {string} CTI 状态
  258. * Initial: 初始状态
  259. * Ready: SocketStatus Ready && SIPStatus Ready
  260. * Terminated: SocketStatus Terminated || SIPStatus Terminated || 正常调用 unInit 方法卸载
  261. */
  262. declare enum CTIStatus {
  263. Initial = "Initial",
  264. Ready = "Ready",
  265. ReTry = "ReTry",
  266. Terminated = "Terminated"
  267. }
  268. /**
  269. * @enum {string} 通话状态
  270. * 为了防止人工外呼方法被二次调用引发预期以外的问题,增加此状态的流转
  271. * Started: 外呼已开始,此状态下不允许再次发起外呼
  272. * Stopped: 外呼已结束,此状态下可以再次发起外呼
  273. */
  274. declare enum CallStatus {
  275. Started = "Started",
  276. Stopped = "Stopped"
  277. }
  278. /**
  279. * @enum {string} Session 状态
  280. * CTI 目前只有 Invitation(接受会话)的场景,Inviter (主动发起会话)暂时没有
  281. */
  282. declare enum SessionStatus {
  283. /**
  284. * If `Inviter`, INVITE not sent yet.
  285. * If `Invitation`, SDK 收到 INVITE 通话请求,但尚未处理.
  286. */
  287. Initial = "Initial",
  288. /**
  289. * If `Inviter`, sent INVITE and waiting for a final response.
  290. * If `Invitation`, received INVITE and attempting to send 200 final response (but has not sent it yet).
  291. */
  292. Establishing = "Establishing",
  293. /**
  294. * If `Inviter`, sent INVITE and received 200 final response and sent ACK.
  295. * If `Invitation`, SDK 完成接受 INVITE 并发送 200 OK 确认接起,同时接通本地语音流.
  296. */
  297. Established = "Established",
  298. /**
  299. * If `Inviter`, sent INVITE, sent CANCEL and now waiting for 487 final response to ACK (or 200 to ACK & BYE).
  300. * If `Invitation`, received INVITE, sent 200 final response and now waiting on ACK and upon receipt will attempt BYE
  301. * (as the protocol specification requires, before sending a BYE we must receive the ACK - so we are waiting).
  302. */
  303. Terminating = "Terminating",
  304. /**
  305. * If `Inviter`, sent INVITE and received non-200 final response (or sent/received BYE after receiving 200).
  306. * If `Invitation`, SDK 收到 BYE 信令,发送 200 OK 挂断确认,会话结束.
  307. */
  308. Terminated = "Terminated"
  309. }
  310. /**
  311. * @enum {string} CTI 所有错误的分类
  312. * SdkTerminated: SDK 不可用错误,需要重新初始化
  313. * SdkError: SDK 状态可用,其他普通错误
  314. * ServerTerminated: 服务端不可用错误,需要重新初始化,透传服务端 code,msg
  315. * ServerError: 服务端可用,普通错误,透传服务端 code,msg
  316. */
  317. declare enum CTIErrorType {
  318. SdkTerminated = "SdkTerminated",
  319. SdkError = "SdkError",
  320. ServerTerminated = "ServerTerminated",
  321. ServerError = "ServerError"
  322. }
  323. /**
  324. * @enum {string} SdkTerminated 类型错误的 code 枚举
  325. * CTITerminated: SDK 状态不可用,CTIStatus 的状态为 Terminated
  326. * GetUserMedia: 获取坐席媒体权限失败
  327. * GetInitConfig: 调接口获取 CTI 初始化配置失败
  328. * SocketOnError: 监听 socket.io 的 error 事件
  329. * SocketOnConnectError: 监听 socket.io 的 connect_error 事件
  330. * SocketOnDisconnect: 监听 socket.io 的 disconnect 事件
  331. * SocketRepeatLogin: 多页面重复登录,IM 互踢事件
  332. * SIPInitUserAgent: SIP UserAgent 初始化时启动失败
  333. * SIPInitRegister: SIP Register 初始化时注册失败
  334. * SIPUserAgentStateStopped: 监听 SIP UserAgent stateChange 事件状态变更为 Stopped
  335. * SIPTransportStateDisconnected: 监听 SIP Transport StateChange 事件状态变更为 Disconnect
  336. * SIPRegistererStateTerminated: 监听 SIP Registerer StateChange 事件状态变更为 Terminated
  337. * SIPOnDisconnect: 监听 SIP OnDisconnect 事件收到异常退出 error
  338. * SIPInitTransport: SIP Transport 初始化时连接失败
  339. * SipHeartBeatErr: SIP发送心跳OPTIONS事件时收到异常结果
  340. * SIPUnRegistered: 注册SIP时失败
  341. * SocketOnReconnectFailed: Socket重连超过阈值且依然重连失败
  342. */
  343. declare enum HskTerminatedCode {
  344. CTITerminated = "100001",
  345. GetUserMedia = "100002",
  346. GetInitConfig = "100003",
  347. SocketOnError = "110001",
  348. SocketOnConnectError = "110002",
  349. SocketOnDisconnect = "110003",
  350. SocketRepeatLogin = "110004",
  351. SocketOnReconnectFailed = "110007",
  352. SIPInitUserAgent = "120001",
  353. SIPInitRegister = "120002",
  354. SIPUserAgentStateStopped = "120003",
  355. SIPTransportStateDisconnected = "120004",
  356. SIPRegistererStateTerminated = "120005",
  357. SIPOnDisconnect = "120006",
  358. SIPInitTransport = "120007",
  359. SipHeartBeatErr = "120008",
  360. SIPUnRegistered = "120009"
  361. }
  362. /**
  363. * @enum {string} SdkError 类型错误的 code 枚举
  364. * Answer: SIP accept 接起失败
  365. * Bye: SIP bye 挂断失败
  366. * InvitationCancel: SIP Invitation 会话请求被取消
  367. * AssignStream: 播放语音流失败
  368. * FetchError: 修饰器handleApiRes当进入到catch时上报此code
  369. */
  370. declare enum SdkErrorCode {
  371. Answer = "200001",
  372. Bye = "200002",
  373. InvitationCancel = "200003",
  374. AssignStream = "200004",
  375. FetchError = "200005"
  376. }
  377. /**
  378. * @enum {string} CTI 事件推送
  379. * OnCtiError: CTI 错误事件,含前后端所有错误,SDK 推送
  380. * OnSessionStatusChange: 坐席侧 SIP 会话状态变更事件,SDK 推送
  381. * OnInitalSuccess: CTI 初始化成功事件,SDK 推送
  382. * OnAgentWorkReport: 坐席&用户状态变更事件,Server 推送
  383. * OnRingStart: 手动外呼用户未接听时,开始播放回铃音,Server 推送
  384. * OnRingEnd: 手动外呼用户未接听时,播放回铃音结束,Server 推送
  385. * OnAgentReport: 坐席状态变更事件,Server 推送
  386. * OnCallReportInfo: 通话时长及通话次数等信息,Server 推送
  387. * OnDetectedTone: 服务端收到音频信号后推送
  388. */
  389. declare enum CTIEvent {
  390. OnCtiError = "OnCtiError",
  391. OnSessionStatusChange = "OnSessionStatusChange",
  392. OnInitalSuccess = "OnInitalSuccess",
  393. OnAgentWorkReport = "OnAgentWorkReport",
  394. OnRingStart = "OnRingStart",
  395. OnRingEnd = "OnRingEnd",
  396. OnDetectedTone = "OnDetectedTone",
  397. OnAgentReport = "OnAgentReport",
  398. OnCallReportInfo = "OnCallReportInfo",
  399. OnCallRing = "OnCallRing",
  400. OnCallEnd = "OnCallEnd",
  401. OnCallAnswer = "OnCallAnswer",
  402. OnAgentGroupQuery = "OnAgentGroupQuery",
  403. OnMethodResponseEvent = "OnMethodResponseEvent",
  404. OnEventPrompt = "OnEventPrompt",
  405. OnPrompt = "OnPrompt"
  406. }
  407. /** @interface CTIRes CTI 对外方法暴露 promise 结果 */
  408. interface CTIRes {
  409. code: number;
  410. data: any;
  411. msg: string;
  412. }
  413. interface CTIManualCallOptions {
  414. called: string;
  415. caller: string;
  416. ext?: object;
  417. }
  418. /** @class HsCTI 红杉外呼类 */
  419. declare class HsCTI extends EventEmitter {
  420. private logger;
  421. loggerLevel: LoggerLevels;
  422. /** HsCTI 实例 */
  423. static instance: HsCTI | undefined;
  424. scene: Scene;
  425. agent_id: string;
  426. saas_id: string;
  427. /** 接口返回的初始化配置 */
  428. private _initOptions;
  429. /** IM socket的实例 */
  430. private _socket;
  431. /** sip.js UA实例 */
  432. private _sipUserAgent;
  433. private _callId;
  434. private _ctiFlowIdList;
  435. /** 基本参数 */
  436. private _baseParams;
  437. /** 等待提示音播放器 */
  438. private _waitAudio;
  439. /** 振铃提示音播放器 */
  440. private _ringAudio;
  441. /** 结束通话提示音 */
  442. private _byeAudio;
  443. /** 远端音频流播放器 */
  444. private _remoteAudio;
  445. /** CTI状态 */
  446. private _ctiStatus;
  447. private _ctiStatusList;
  448. /** sip状态 */
  449. private _sipStatus;
  450. private _sipStatusList;
  451. /** socket状态 */
  452. private _socketStatus;
  453. private _socketStatusList;
  454. private _callStatus;
  455. private _terminatedStatusList;
  456. private constructor();
  457. get getCTIStatus(): CTIStatus;
  458. get getSocketStatus(): SocketStatus;
  459. get getSIPStatus(): SIPStatus;
  460. static getInstance(hsCTIInitOptions: HsCTIInitOptions | RequiredHsCTIInitOptions): HsCTI;
  461. /** @private 重置实例 */
  462. private initInstanceOptions;
  463. /** @private 优雅关闭 SIP 和 socket */
  464. private clearSocketAndSip;
  465. /**
  466. * @private 设置等待音 src
  467. * @param {AudioName} audioName
  468. * @param {boolean} loop
  469. */
  470. private setAudioSrc;
  471. private playAudio;
  472. private stopLocalAudio;
  473. private stopAudio;
  474. init(): void;
  475. private getInitConfig;
  476. private initSocket;
  477. private handleSocketDownEvent;
  478. /** @private serverEventEmit 统一处理服务端推送的事件 */
  479. private serverEventEmit;
  480. private initSip;
  481. private sipDelegate;
  482. private sessionStateChangeAndTrack;
  483. /**
  484. * @private setCTIStatus CTI 状态流转
  485. * @param {CTIStatus} ctiStatus
  486. */
  487. private setCTIStatus;
  488. /**
  489. * @private setSocketStatus Socket 状态流转
  490. * @param SocketStatusChangeParams Socket 状态流转参数及错误详情等
  491. */
  492. private setSocketStatus;
  493. /**
  494. * @private setSipStatus SIP 状态流转
  495. * @param SIPStatusChangeParams SIP 状态流转参数及错误详情等
  496. */
  497. private setSipStatus;
  498. /**
  499. * @private socketOrSipStatusChange Socket 或 SIP 状态变化可能引起 CTI 状态变化
  500. * @param {SocketStatus} socketStatus
  501. * @param {SIPStatus} sipStatus
  502. */
  503. private socketOrSipStatusChange;
  504. /**
  505. * @private eventEmitAndTrack SDK 对外抛出事件并统一埋点
  506. * @param {CTIEvent} eventName 事件名称
  507. * @param {object} ext 事件参数
  508. * @param { error } error 错误详情或错误辅助信息
  509. */
  510. private eventEmitAndTrack;
  511. /** @private checkIn 服务端签入,CTIStatus Ready 时自动调用,坐席状态变更 */
  512. private checkIn;
  513. /** @public checkOut 服务端签出, unInit 时自动调用,坐席状态变更 */
  514. checkOut(): Promise<CTIRes>;
  515. /** @private _getCtiFlowId 获取手动外呼场景需要的 ctiFlowId */
  516. private getCtiFlowId;
  517. /** @public setIdle 服务端置闲,坐席状态变更 */
  518. setIdle(): Promise<CTIRes>;
  519. /** @public setBusy 服务端置忙,坐席状态变更 */
  520. setBusy(): Promise<CTIRes>;
  521. makeCall(params: CTIManualCallOptions): Promise<CTIRes | undefined>;
  522. private serverCall;
  523. /** @public answer SDK SIP 接起 */
  524. answer(): Promise<CTIRes>;
  525. /** @public bye SDK SIP 挂断 */
  526. bye(): Promise<CTIRes>;
  527. /** @public serverBye 挂断且流转坐席状态 */
  528. serverBye(): Promise<CTIRes | undefined>;
  529. /** @public turnHang 流转坐席状态-通话结束 */
  530. private turnHang;
  531. /** @public getAgentStatus 获取坐席状态 */
  532. getAgentStatus(): Promise<CTIRes>;
  533. /**
  534. * @public loadAgentGroupData 监听-根据监听组 ID 获取监听组成员
  535. * @param {string[]} monitorIds
  536. */
  537. loadAgentGroupData(monitorIds: string[]): Promise<CTIRes>;
  538. /**
  539. * @public listen 监听-服务端发起监听
  540. * @param {string} monitoredAgNo
  541. */
  542. listen(monitoredAgNo: string): Promise<CTIRes>;
  543. /**
  544. * @public setActiveService 机器人外呼-签入人工组
  545. * @param {string} serviceId
  546. */
  547. setActiveService(serviceId: string): Promise<CTIRes>;
  548. /** @public unInit 卸载 SDK,checkOut 成功后断开 socket 和 sip 连接,并销毁 SdCTI 实例 */
  549. unInit(): Promise<void>;
  550. }
  551. /**
  552. * @function getInstance 获取 HsCTI 的实例
  553. * @param HsCTIInitOptions 初始化 HsCTI 的配置
  554. */
  555. declare const getInstance: (HsCTIInitOptions: HsCTIInitOptions | RequiredHsCTIInitOptions) => HsCTI;
  556. export { BaseHsCTIInitOptions, BaseOptions, CTIErrorType, CTIEvent, CTIRes, CTIStatus, CallStatus, ENV, ExcludeScene, HsCTI, HsCTIInitOptions, HskTerminatedCode, Logger, LoggerLevels, MonitorScene, RequiredHsCTIInitOptions, SIPStatus, Scene, SdkErrorCode, SessionStatus, SocketStatus, getInstance };