Closed benzmuircroft closed 8 years ago
I've made an attempt to contain your module under a node.js domain to try to catch and restart the slack-client on your errors (the errors seem very low level - within your node_modules)
What is the function you've registered as created
in your code snippet?
rtm.on(RTM_EVENTS.CHANNEL_CREATED,created);//go do stuff with the channel
web.channels.create(U.username);
The crash you're seeing looks like it indicates that it's a null value. I'd check in your code to see whether it's getting nulled out anywhere.
LOL It is! I nulled it after as I wanted to stop listening after it's created!
function created(ch){
console.log('created',ch);
if(ch.channel.name==U.username){
ⵌ.cid=ch.channel.id;
ⵌ.rtm.on(ⵌ.RTM_EVENTS.CHANNEL_CREATED,null);//stop listening <<<<<-------- here
G.SLACK[ⵌ.cid]={uid:U.id,'suid':s[1].uid};//saved a note of the connected user
post();
}
return;
}
How do I stop listening properly without causing this error?
You can look at the removeListener
call on https://github.com/primus/eventemitter3
After my app created a channel
I always create channels the same way (with the same code) but for some reason this time my whole app crashed
but It crashed (when normally on creating a channel it does not crash)