Adding triggering support #203
Replies: 8 comments
-
Hi! OpenEXP is a really neat project. I'm glad to be in touch. There's a short term and a long term solution. I'd like to get to the long term solution eventually, but it won't happen anytime soon. Short term: Fork the single-stim plugin or any other plugin that you want to use to display the stimuli, and add the socket.emit message in the plugin file at the appropriate location. A slightly more sophisticated solution would be to use Long term: Create a single function in the core jsPsych library that is used to display things on the screen. This would centralize the stimulus display function and make it so that you only had to add the socket.emit message in a single location. This turns out to be complicated for a variety of reasons, and is probably at least six months away from getting any attention on my end. |
Beta Was this translation helpful? Give feedback.
-
@jodeleeuw, thanks for the suggestion. I was able to get it to work with the short-term solution. I found out that I needed to make socket global in order for it to work, which makes sense, along with a few other things. as for the long-term solution, I like the proposal. If I could help at all, let me know. I've been looking through the jsPsych core library, but there's a lot of (good) stuff to unpack there :) it does sound like that might be a more extensive change with restructuring the display function. feel free to close the issue if you would like, unless you want to keep it open as reminder. |
Beta Was this translation helpful? Give feedback.
-
I'm still learning about sockets, and socket.io in particular, so this may be a naive question. Right now, jsPsych is entirely a client-side library. There is a project in the works, jsPsych.node, which will implement some server-side features as an optional add-on for jsPsych. Can this kind of trigger support be added without a server? |
Beta Was this translation helpful? Give feedback.
-
The way we have it set up currently is that the openbci hardware talks to a server, which also serves the web app. jsPsych, on the client side, sends a code (a backtick character `) each time a stimulus is presented, through socket.io, which is running on both the client and the server. On the server side, socket.io is listening for that code, and passes it on to the hardware when it receives it. I think it would be possible to set up some conditional statements in jsPsych to let a researcher startup a socket.io server and send triggers upon request. We've hard-coded this into Teon's fork of jsPsych https://github.com/teonlamont/jsPsych/tree/trigger, but it could probably be achieved in a more elegant manner if we put some thought into it. We are actually moving forward with a desktop app, since the timing and environment will be more controlled. The plan is to still have a web-based OpenEXP, but without the hardware interfacing. We're making a lot of ground now that we've got a few more developers in on the project. We'll keep you in the loop as things develop! |
Beta Was this translation helpful? Give feedback.
-
I'm going to close this issue here. I've got the very early stages of a Node.js server for jsPsych built, and this is the kind of thing that would fit better in that package. Once I've made it public on GitHub, I'll add this issue to that project. |
Beta Was this translation helpful? Give feedback.
-
sounds good! |
Beta Was this translation helpful? Give feedback.
-
Hey Josh, Any updates on the node.js server? We noticed that the plugin code was restructured, and it breaks our implementation of the triggers we were sending to our openbci board. Rather than patching that again, we are looking for a more permanent solution. |
Beta Was this translation helpful? Give feedback.
-
There's an undocumented version that is working reliably but with a pretty limited feature set. It's in this repository. Right now the focus is on multiplayer experiments and built in data storage. |
Beta Was this translation helpful? Give feedback.
-
hi @jodeleeuw, @andyh616 and I have been working on OpenEXP, a presentation software for EEG, thanks to the backend support with jsPsych! :) We were wondering if it's possible to add a triggering event with the stimulus presentation. I began to think of an external add-on but I realize that we would want to modify within the trial, which is where I was stumped. Would there be a way to override/add to this. Essentially we would have this:
the external would be responsible setting up the trigger communication:
and stimulus presentation would call a function that supports sending these values for
trigger
:do you have any suggestions on the best way to go about doing this?
Beta Was this translation helpful? Give feedback.
All reactions