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: 
salman23
Visitor

Device Linking problem

Hi,
I have a rendezvous channel registration screen in my roku channel.It will generate a linking code on first call.And then after typing and linking the code in the channel site , the prelink url will be polled after each 15 seconds.But i am getting the successful registration response only during the first prelink call ( Note : only if we have linked the device before the first 15 seconds) .But if i link the device in subsequent intervals after the first prelink call , i will be getting registration failure response. Do anyone have some corrective measures regarding this ?

But the same thing gives successful output on web debugging tools like Charles proxy

below i have given the code snippet :


Function doRegistration()

while true
msg = Wait(15, regscreen.GetMessagePort())
print "sending the request.."
if msg = invalid
print "Request No :";count.ToStr()
if timer.TotalSeconds() >= m.regcodeExpireTime
ShowDialog1Button("","This code has expired. Press OK to get a new one","Ok")
regscreen.SetRegistrationCode("")
regscreen.Show()
goto TOK
end if

status = checkRegistrationStatus(regCode)
if status = 0
print "registration successful in doRegistration()"
print FormatTime(time.TotalSeconds(),"Time taken to register : ")
posterfacade = CreateObject("roPosterScreen") 'facade screen
posterfacade.ShowMessage("Loading...")
posterfacade.Show()
regscreen.Close()
canvas.Close()
return status
else if status > 0
print "registration pending in doRegistration()"
end if
end if
end while
end Function


debugg output response during the first prelink call ( Note : if i have linked the device after the first 15 seconds):

sending the request..
Request No :1
transfer is completed and status is :1
invalid response code 404 and response not received.
url :https://someapi.com
failure reason :The requested URL returned error: 404
registration pending in doRegistration()
sending the request..
Request No :2
transfer is completed and status is :1
invalid response code 404 and response not received.
url :https://someapi.com
failure reason :The requested URL returned error: 404
registration pending in doRegistration()
...............
.............. continues

But in case if i had linked the device before the first 15 seconds, i will get the successful registration result.Can anyone have an inner view into that ?

Thanks.
0 Kudos
4 REPLIES 4
destruk
Streaming Star

Re: Device Linking problem

404 is page not found, so your url is bad.
0 Kudos
salman23
Visitor

Re: Device Linking problem

"destruk" wrote:
404 is page not found, so your url is bad.


Thanks for your quick response Destruk.But i am getting the successful registration result when i call the prelink url within the first 15 seconds.That means i should have registered in the website before the first prelink call goes.If the case is the problem with url as u said, it should have returned 404 ,here also.But it is getting fine here.Any guess ?

Please Note : The same thing gives successful output on web debugging tools like Charles proxy.So this shows the request from Roku is making some problem.Right?
0 Kudos
destruk
Streaming Star

Re: Device Linking problem

If you resolve the 404 error then perhaps it will work after the first 15 seconds. You'll need to figure that out as it pertains to your server and code interaction with your server.
You can check the status of a url by putting a 'stop' breakpoint in after the http is set, and from the telnet prompt use something like http.geturl()
http://sdkdocs.roku.com/display/sdkdoc/ ... rlasString

There are other debugging checks you can do, add print statements, test what the request from the roku is, debug your erorr log on the server, etc. You're not giving us much to go on saying it just works the first time. Why does it work the first time? Find that out and the rest will become more obvious.

With your roku code saying the code has 'expired' - perhaps you're not updating the code on the server side when the roku changes the code, or they are no longer in sync. It could be any number of hundreds of possible problems even down to a typo in one of the scripts or files on your server.
0 Kudos
salman23
Visitor

Re: Device Linking problem

Yes. It was a great suggestion from your side Destruk.Let me have a check on this.
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.