How to I get the current session in the necessary format for the remoteSendDataEvent command in python
sessionData = ?
rv.commands.remoteSendDataEvent('remote-push-session', 'contactSession', 'session-data', [sessionData], [contact])
Thanks
How to I get the current session in the necessary format for the remoteSendDataEvent command in python
sessionData = ?
rv.commands.remoteSendDataEvent('remote-push-session', 'contactSession', 'session-data', [sessionData], [contact])
Thanks
I got it working.
import rv.commands
import tempfile
def sessionAsByteArray(filename, chunksize=8192):
byteIntArray = list()
with open(filename, "rb") as f:
while True:
chunk = f.read(chunksize)
if chunk:
for b in chunk:
byteIntArray.append(ord(b))
else:
break
return byteIntArray
# Temp file for session
tempDir = tempfile.gettempdir()
sessionFile = tempDir + '/sessionToRemote.rv'
# Write session to binary file
rv.commands.saveSession(sessionFile, True, True, False)
# Send session to contacts
sdt = sessionAsByteArray(sessionFile)
con = rv.commands.remoteConnections()
rv.commands.remoteSendDataEvent('remote-push-session', '(not used)', 'session-data', sdt, con)