Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jedashford
Channel Surfer

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?
0 Kudos
2 REPLIES 2
TheEndless
Channel Surfer

Re: Trying to construct a message port on a non-plugin threa

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".
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jedashford
Channel Surfer

Re: Trying to construct a message port on a non-plugin threa

Thanks, that was it. Makes sense now after your response and reading the docs 🙂
0 Kudos