i broke it :)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { PluginListenerHandle } from "@capacitor/core";
|
||||
|
||||
export interface SocketsPlugin {
|
||||
create(options: { id: string; host: string; port: number, useTLS?: boolean, acceptInvalidCertificates?: boolean }): Promise<void>;
|
||||
connect(options: { id: string; }): Promise<void>;
|
||||
create(options: { id: string; }): Promise<void>;
|
||||
connect(options: { id: string; host: string; port: number, useTLS?: boolean, acceptInvalidCertificates?: boolean }): Promise<void>;
|
||||
send(options: { id: string; message: string }): Promise<void>;
|
||||
disconnect(options: { id: string }): Promise<void>;
|
||||
close(options: { id: string }): Promise<void>;
|
||||
|
||||
@@ -51,21 +51,13 @@ class SocketManager {
|
||||
|
||||
export default class Socket {
|
||||
id: string;
|
||||
host: string;
|
||||
port: number;
|
||||
useTLS: boolean;
|
||||
acceptInvalidCertificates: boolean;
|
||||
|
||||
private emitter: Emitter<SocketEvents>;
|
||||
|
||||
constructor(config: { id: string; host: string; port: number; useTLS?: boolean; acceptInvalidCertificates?: boolean }) {
|
||||
constructor(config: { id: string }) {
|
||||
console.log(config);
|
||||
|
||||
this.id = config.id;
|
||||
this.host = config.host;
|
||||
this.port = config.port;
|
||||
this.useTLS = config.useTLS ?? false;
|
||||
this.acceptInvalidCertificates = config.acceptInvalidCertificates ?? false;
|
||||
|
||||
this.emitter = mitt<SocketEvents>();
|
||||
|
||||
@@ -80,23 +72,23 @@ export default class Socket {
|
||||
|
||||
create() {
|
||||
Sockets.create({
|
||||
id: this.id,
|
||||
host: this.host,
|
||||
port: this.port,
|
||||
useTLS: this.useTLS,
|
||||
acceptInvalidCertificates: this.acceptInvalidCertificates,
|
||||
id: this.id
|
||||
});
|
||||
}
|
||||
|
||||
connect() {
|
||||
connect(config: { host: string; port: number; useTLS?: boolean; acceptInvalidCertificates?: boolean }) {
|
||||
Sockets.connect({
|
||||
id: this.id,
|
||||
host: config.host,
|
||||
port: config.port,
|
||||
useTLS: config.useTLS ?? false,
|
||||
acceptInvalidCertificates: config.acceptInvalidCertificates ?? false
|
||||
});
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
Sockets.disconnect({
|
||||
id: this.id,
|
||||
id: this.id
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user