Atom Package Socket Event Activation


Hi there,
I am building an atom package for paired programming. Everything works fine except one part, before entering the socket event function I have to type something into the editor or just press Ctrl + Shift + P, after that, everything works okay. I’m not sure if the editor is slow, or I have to focus on editor, or something’s wrong with the socket. Any suggestion would be very helpful :grinning: . It feels like atom freezes when the focus is lost, including console logging.


Does your package have any activation commands?


Yes, I have 6 activation commands, each one corresponding for a menu item.


So could that be why you have to perform some action before things start?


No, I am not expecting triggering socket events until I start a session. In my activate method I start adding listening to socket events. Here is my repo if it is helpful in one way or another:


Just to clarify, Lee means commands in package.json. You don’t need to put them in there to use the keystrokes.


Yes, these are the commands from package.json file


Sorry for dragging out this thread, but did you know that the presence of any commands in package.json will cause the package to not activate until a command is used? To activate on boot make sure no commands are in package.json.


Thanks for answering but I don’t want to activate on boot, I want to activate if someone clicks on the menu or types the command using Ctrl-Shift-P and the command name. What I mean by pressing Ctrl-Shift-P, well…I don’t have to type any command name or press enter after I activated the plugin, I guess it’s just the editor loosing focus…Another fix is user typing something into the editor window, this is my only problem, I want the socket activation to be triggered unconditioned after activation. Maybe I wasn’t clear at the beginning.

My problem shortly: if my editor window is not focused, my package does nothing, not even console logging my data from the server. If i type something, or move the windows, or refocus, everything works instantly.


You will have to activate at boot.


Thank you for your help guys, I discovered the problem. The issue was with my node server, after pushing to heroku everything works perfect, I guess the server sleeps on my machine and delays the activity.