42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
// Metro module 10636 (f10637).
|
|
import { RPCCloseCodes, RPC_VERSION } from "../../../Constants";
|
|
import Module12 from "../../../_bundle/Module12";
|
|
import RPCError from "../RPCError";
|
|
class BaseSocket {
|
|
constructor(a0, a1, a2) {
|
|
const r16 = {
|
|
__proto__: new.target.prototype,
|
|
id: Module12.uniqueId(),
|
|
authorization: null,
|
|
application: null,
|
|
abortController: null
|
|
};
|
|
r16.authorization = {
|
|
authing: false,
|
|
scopes: [],
|
|
accessToken: null,
|
|
expires: new Date(0)
|
|
};
|
|
r16.application = {
|
|
id: null,
|
|
name: null,
|
|
icon: null
|
|
};
|
|
r16.abortController = new AbortController();
|
|
r16.transport = a0;
|
|
r16.version = a1;
|
|
r16.encoding = a2;
|
|
r16.checkRpcVersion(a1);
|
|
return r16;
|
|
}
|
|
checkRpcVersion(a0) {
|
|
if (a0 != null && !(a0 > RPC_VERSION) && !(a0 < 1)) {
|
|
return void 0;
|
|
}
|
|
throw new RPCError({
|
|
closeCode: RPCCloseCodes.INVALID_VERSION
|
|
}, `Invalid Version: ${a0}`);
|
|
}
|
|
}
|
|
export default BaseSocket;
|