Socket commands
This commit is contained in:
1 parent
6357571f7d
commit
373f6c397a
1 file changed
+26
@@ -14,6 +14,32 @@ class Request {
|
||||
}
|
||||
}
|
||||
|
||||
export var commands = {
|
||||
'socket': com => {
|
||||
var actions = {
|
||||
'connect': ()=> {
|
||||
if (com.con.Socket.socket.disconnected) {
|
||||
com.con.Socket.socket.connect()
|
||||
com.log(`Connecting to ${com.con.Socket.hostname}`, 'info')
|
||||
} else {
|
||||
com.log(`Socket already connected`, 'error')
|
||||
}
|
||||
|
||||
},
|
||||
'disconnect': () => {
|
||||
if (com.con.Socket.socket.connected){
|
||||
com.con.Socket.socket.disconnect()
|
||||
com.log(`Disconnecting from ${com.con.Socket.hostname}`, 'warning')
|
||||
} else {
|
||||
com.log(`Socket not connected`, 'error')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
actions[com.arg[0]]()
|
||||
}
|
||||
}
|
||||
|
||||
export default class Socket {
|
||||
|
||||
constructor(con) {
|
||||
|
||||
Reference in new issue
Block a user