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: 
casolorz
Roku Guru

Is it possible to run a server inside a Roku channel?

I have an Android app that sends videos to streaming devices. I would like to hire someone to write a Roku channel for it, the Roku channel would need to receive a command to play a video and return back to the app whether it succeeded, and also send to the app some playback state events like when the video is paused, buffering, etc, as well as let the app query the current position and duration of the video. 

For this I was hoping to run a web server on the Roku but on my initial conversations with Roku developers (still interviewing) it seems like brightscript might not allow that? Is that the case? And if so, what is the preferred way to have communication between the mobile app and the Roku? I can easily run a web server on the mobile app (already do) but then the Roku would have to open a connection to the mobile app and wait for the command, is that possible? 

Thank you. 
0 Kudos
10 REPLIES 10
ioan
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"casolorz" wrote:
I have an Android app that sends videos to streaming devices. I would like to hire someone to write a Roku channel for it, the Roku channel would need to receive a command to play a video and return back to the app whether it succeeded, and also send to the app some playback state events like when the video is paused, buffering, etc, as well as let the app query the current position and duration of the video. 

For this I was hoping to run a web server on the Roku but on my initial conversations with Roku developers (still interviewing) it seems like brightscript might not allow that? Is that the case? And if so, what is the preferred way to have communication between the mobile app and the Roku? I can easily run a web server on the mobile app (already do) but then the Roku would have to open a connection to the mobile app and wait for the command, is that possible? 

Thank you. 

You CAN have a web server inside a Roku application, my channel IP Camera Viewer Pro does just that for the "Easy Add" feature (aka the user uses their browser on the computer or phone to enter the camera info). 
See echo server here: https://sdkdocs.roku.com/display/sdkdoc/roStreamSocket
https://github.com/e1ioan/
http://rokucam.com
0 Kudos
casolorz
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"ioan" wrote:

You CAN have a web server inside a Roku application, my channel IP Camera Viewer Pro does just that for the "Easy Add" feature (aka the user uses their browser on the computer or phone to enter the camera info). 
See echo server here: https://sdkdocs.roku.com/display/sdkdoc/roStreamSocket

Thank you for that info, I had seen that but it seems like it is just a socket, so the developer I hire would need to implement an HTTP server on top of that. I was hoping there was some Roku provided or Open Source library that already did that. Is there one?
0 Kudos
belltown
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"casolorz" wrote:
I was hoping there was some Roku provided or Open Source library that already did that. Is there one?


From the old Roku SDK examples: https://forums.roku.com/viewtopic.php?t=64930
0 Kudos
casolorz
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"belltown" wrote:
"casolorz" wrote:
I was hoping there was some Roku provided or Open Source library that already did that. Is there one?


From the old Roku SDK examples: https://forums.roku.com/viewtopic.php?t=64930

Awesome, thank you for those links. 
0 Kudos
NB_
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"casolorz" wrote:
... what is the preferred way to have communication between the mobile app and the Roku? I can easily run a web server on the mobile app (already do) but then the Roku would have to open a connection to the mobile app and wait for the command, is that possible? 

your use case does not require a Roku-side server.
if i were implementing this, i'd have the external app launch the Roku channel via ECP, passing URL to be contacted back. Then Roku do a long-poll http to the Android app - while it sounds counter-intuitive for reversing the implementation of who the client and who the server is, that's lower level implementation detail; the mobile app can still control the Roku play.
0 Kudos
casolorz
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"RokuNB" wrote:
"casolorz" wrote:
... what is the preferred way to have communication between the mobile app and the Roku? I can easily run a web server on the mobile app (already do) but then the Roku would have to open a connection to the mobile app and wait for the command, is that possible? 

your use case does not require a Roku-side server.
if i were implementing this, i'd have the external app launch the Roku channel via ECP, passing URL to be contacted back. Then Roku do a long-poll http to the Android app - while it sounds counter-intuitive for reversing the implementation of who the client and who the server is, that's lower level implementation detail; the mobile app can still control the Roku play.

That is exactly what I'm currently discussing with the developers I'm interviewing. Is long-poll pretty easy to do on the Roku? 
0 Kudos
NB_
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"casolorz" wrote:
That is exactly what I'm currently discussing with the developers I'm interviewing. Is long-poll pretty easy to do on the Roku? 

Yes. "Long poll" is just a normal HTTP call, the twist is that the web server is "holding the ball" till it has a command to send back. i.e. it's a way to reverse control.

Think Roku periodically, repeatedly asking the phone "got any orders for me?" - "no", till eventually app says "ok, play this" or "ok, pause". That's "polling".

If inclined, that can be optimized to the server holding on response to the request till it has new info to send. That's long polling.
0 Kudos
casolorz
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"RokuNB" wrote:
"casolorz" wrote:
That is exactly what I'm currently discussing with the developers I'm interviewing. Is long-poll pretty easy to do on the Roku? 

Yes. "Long poll" is just a normal HTTP call, the twist is that the web server is "holding the ball" till it has a command to send back. i.e. it's a way to reverse control.

Think Roku periodically, repeatedly asking the phone "got any orders for me?" - "no", till eventually app says "ok, play this" or "ok, pause". That's "polling".

If inclined, that can be optimized to the server holding on response to the request till it has new info to send. That's long polling.

Yeap I've done it before with other projects, I was hoping to avoid that since the mobile app is likely to have less resources than the roku (I'm guessing) but sounds like it will be my best option. Thanks for the help. 

Would a combination of the mobile app having a server and roInput make sense? or is roInput going away someday?
0 Kudos
NB_
Roku Guru

Re: Is it possible to run a server inside a Roku channel?

"casolorz" wrote:
Would a combination of the mobile app having a server and roInput make sense?

Sure, you can "push" messages Android->Roku with ECP `/input`, send the opposite way via http. No long or repetitive polling: even better.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.