make the class instance the default context for packet commands
parent
1b846c4753
commit
bb0ca93e43
|
@ -10,7 +10,7 @@ export default class Consumer extends Socket {
|
|||
// set or tcp socket
|
||||
if (typeof(path)!=='string') {
|
||||
opts = path
|
||||
this.host = opts.host || '127.0.0.1'
|
||||
this.host = opts.host || '127.0.0.1' // TODO log a warning about host on same machine
|
||||
this.port = opts.port || 8080
|
||||
} else this.path = path
|
||||
this.packet = {
|
||||
|
@ -46,9 +46,7 @@ export default class Consumer extends Socket {
|
|||
async connect (context) {
|
||||
|
||||
if (context) this.packet.context = context
|
||||
|
||||
// console.log('consumer processing=>',app.pp,'=>', app[app.pp])
|
||||
// console.log('========================')
|
||||
else this.packet.context = this
|
||||
|
||||
this.listen()
|
||||
this.log.info('listening')
|
||||
|
|
|
@ -12,7 +12,7 @@ export default class Socket extends Server {
|
|||
// set or tcp socket
|
||||
if (typeof(path)!=='string') {
|
||||
opts = path
|
||||
this.listen_opts = { host: opts.host || '127.0.0.1', port: opts.port || 8080}
|
||||
this.listen_opts = { host: opts.host || '0.0.0.0', port: opts.port || 8080}
|
||||
} else this.listen_opts = { path: path }
|
||||
// default packet processing
|
||||
this.packet = {
|
||||
|
@ -36,6 +36,7 @@ export default class Socket extends Server {
|
|||
async create (context) {
|
||||
|
||||
if (context) this.packet.context = context
|
||||
else this.packet.context = this
|
||||
|
||||
return new Promise( async (resolve,reject) => {
|
||||
|
||||
|
|
Loading…
Reference in New Issue