Forum Discussion

jedashford's avatar
jedashford
Channel Surfer
10 years ago

Trying to construct a message port on a non-plugin thread:

I'm attempting to get the user's info for a sign up flow in a scene graph component.

I read that I'll need to construct the store object inside of Task. I also need to assign a port as described in the documentation so I can pull the user's info. I end up getting an error when running this code:

<component name="storeRegister" extends="Task">

<script type="text/brightscript" >
<![CDATA[

sub init()
store = CreateObject("roChannelStore")
port = CreateObject("roMessagePort")
store.SetMessagePort(port)
testUser = store.GetPartialUserData("email, firstname")
end sub


Error:

BRIGHTSCRIPT: ERROR: roMessagePort: Trying to construct a message port on a non-plugin thread: ...IQ/pkg:/components/store_register.xml(12)

013:* store.SetMessagePort(port)


How are others accessing store user data from within the scene graph API?
  • init() on a Task node is fired in the main SceneGraph thread. You need to set m.top.functionName and move your code to there, then set the control field of the task node to "RUN".
  • Thanks, that was it. Makes sense now after your response and reading the docs 🙂