尝试在 Roku 频道中断开连接会引发错误
Attempting to disconnect in Roku channel throws error
我正在尝试获取 sample auth linking Roku channel to work. I’ve installed the channel on my Roku stick, set up endpoints for generating and authenticating tokens, but can’t get the disconnect endpoint to work. The Roku Developer Documentation on Authentication and Linking 也没有用,因为该页面上的响应与我在应用程序中实际 return 的响应不匹配。
我的断开连接代码如下所示:
sub parseDis(job as object)
result = job.context.context.response
json = parseJSON(result.content)
if json.success = "no"
m.top.disconnect = false
else
m.top.disconnect = true
end if
end sub
所以在我的应用程序中,我 returning 一个 JSON 响应,如下所示:
{
"success": "yes"
}
但是在 Telnet 调试控制台会话中我得到了这个输出:
Suspending threads...
Thread selected: 2* ...:/components/RegistryTask.xml(55)
Current Function:
052: sec.Write(key, val)
Function RegWrite(key, val, section=invalid)
053: if section = invalid then section = "Default"
054: sec = CreateObject("roRegistrySection", section)
055:* sec.Write(key, val)
056: sec.Flush() 'commit it
057: End Function
Type Mismatch. (runtime error &h18) in pkg:/components/RegistryTask.xml(55)
055: sec.Write(key, val)
Backtrace:
#1 Function regwrite(key As Dynamic, val As Dynamic) As Dynamic
file/line: pkg:/components/RegistryTask.xml(55)
#0 Function go() As Void
file/line: pkg:/components/RegistryTask.xml(35)
Local Variables:
key roString refcnt=3 val:"UNIQUE_ID_HERE3500X"
val Invalid
section String (VT_STR_CONST) val:"Default"
global Interface:ifGlobal
m roAssociativeArray refcnt=3 count:3
sec bsc:roRegistrySection refcnt=1
Threads:
ID Location Source Code
0 pkg:/source/main.brs(15) msg = wait(0, m.port)
1 pkg:/components/SimpleScene.brs(78) oauth_token: invalid
2* ...:/components/RegistryTask.xml(55) sec.Write(key, val)
3[u] ??
*selected [u]unattached(not debuggable)
任何人都可以帮助我破译发生了什么和出了什么问题?
错误的直接原因是:
key roString refcnt=3 val:"UNIQUE_ID_HERE3500X"
val Invalid
Write()
函数采用 2 个字符串,键和值 - 在这种情况下,值是 invalid
,不好。
我快速浏览了示例应用程序,背后更深层次的原因是 onDisconnect()
事件处理程序:
m.regTask.write = {
deviceID: m.rokuDeviceID,
oauth_token: invalid
}
必须以某种方式解决这个问题。我没有查看更多细节 - 例如如果空字符串符合逻辑或更好地使用 roRegistrySection.delete()
我正在尝试获取 sample auth linking Roku channel to work. I’ve installed the channel on my Roku stick, set up endpoints for generating and authenticating tokens, but can’t get the disconnect endpoint to work. The Roku Developer Documentation on Authentication and Linking 也没有用,因为该页面上的响应与我在应用程序中实际 return 的响应不匹配。
我的断开连接代码如下所示:
sub parseDis(job as object)
result = job.context.context.response
json = parseJSON(result.content)
if json.success = "no"
m.top.disconnect = false
else
m.top.disconnect = true
end if
end sub
所以在我的应用程序中,我 returning 一个 JSON 响应,如下所示:
{
"success": "yes"
}
但是在 Telnet 调试控制台会话中我得到了这个输出:
Suspending threads...
Thread selected: 2* ...:/components/RegistryTask.xml(55)
Current Function:
052: sec.Write(key, val)
Function RegWrite(key, val, section=invalid)
053: if section = invalid then section = "Default"
054: sec = CreateObject("roRegistrySection", section)
055:* sec.Write(key, val)
056: sec.Flush() 'commit it
057: End Function
Type Mismatch. (runtime error &h18) in pkg:/components/RegistryTask.xml(55)
055: sec.Write(key, val)
Backtrace:
#1 Function regwrite(key As Dynamic, val As Dynamic) As Dynamic
file/line: pkg:/components/RegistryTask.xml(55)
#0 Function go() As Void
file/line: pkg:/components/RegistryTask.xml(35)
Local Variables:
key roString refcnt=3 val:"UNIQUE_ID_HERE3500X"
val Invalid
section String (VT_STR_CONST) val:"Default"
global Interface:ifGlobal
m roAssociativeArray refcnt=3 count:3
sec bsc:roRegistrySection refcnt=1
Threads:
ID Location Source Code
0 pkg:/source/main.brs(15) msg = wait(0, m.port)
1 pkg:/components/SimpleScene.brs(78) oauth_token: invalid
2* ...:/components/RegistryTask.xml(55) sec.Write(key, val)
3[u] ??
*selected [u]unattached(not debuggable)
任何人都可以帮助我破译发生了什么和出了什么问题?
错误的直接原因是:
key roString refcnt=3 val:"UNIQUE_ID_HERE3500X"
val Invalid
Write()
函数采用 2 个字符串,键和值 - 在这种情况下,值是 invalid
,不好。
我快速浏览了示例应用程序,背后更深层次的原因是 onDisconnect()
事件处理程序:
m.regTask.write = {
deviceID: m.rokuDeviceID,
oauth_token: invalid
}
必须以某种方式解决这个问题。我没有查看更多细节 - 例如如果空字符串符合逻辑或更好地使用 roRegistrySection.delete()