Hello @quasdunk
Welcome to the Community and thank you for trying Backendless!
I just tested the RT System and it works properly for me, here is my code for testing from the client:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://unpkg.com/backendless@6.2.22/dist/backendless.js"></script>
</head>
<body>
<div id="messages"></div>
<script>
const APP_ID = ''
const API_KEY = ''
const log = (() => {
const $messages = document.getElementById('messages')
return (message) => {
$messages.innerText += `• ${ message }\n`
}
})();
const rtLog = message => log(`---> RT Event <---: ${ message }`)
const wait = time => new Promise(r => setTimeout(r, time))
Backendless.initApp(APP_ID, API_KEY)
log('initialized Backendless JS-SDK')
const personsStore = Backendless.Data.of('Persons')
const personsRTStore = personsStore.rt()
personsRTStore.addCreateListener(object => {
rtLog(`receive a new event from the RT Server about creating a Person object: ${ JSON.stringify(object) }`)
})
personsRTStore.addUpdateListener(object => {
rtLog(`receive a new event from the RT Server about updating a Person object: ${ JSON.stringify(object) }`)
})
Backendless.RT.addDisconnectEventListener(() => rtLog('it has been disconnected from the RT Server'))
Backendless.RT.addReconnectAttemptEventListener(() => rtLog('try to reconnect to the RT Server'))
Backendless.RT.addConnectErrorEventListener(error => rtLog(`${ error.message }`))
Backendless.RT.addConnectEventListener(async () => {
rtLog('it has been connected to the RT Server')
log('let\'s try to create/update a Person object')
const newPerson = { name: 'Bob' }
log(`create a new Person object: ${ JSON.stringify(newPerson) }`)
const savedPerson = await personsStore.save({ name: 'Bob' })
log(`created a new Person object: ${ JSON.stringify(savedPerson) }`)
savedPerson.name = 'Nick'
log(`update the Person object: ${ JSON.stringify(savedPerson) }`)
const updatePerson = await personsStore.save(savedPerson)
log(`updated a new Person object: ${ JSON.stringify(updatePerson) }`)
})
</script>
</body>
</html>
Just add your APP_ID
, API_Key
and open it in a web browser
As result, you will see log messages like that:
• initialized Backendless JS-SDK
• ---> RT Event <---: it has been connected to the RT Server
• let's try to create/update a Person object
• create a new Person object: {"name":"Bob"}
• ---> RT Event <---: receive a new event from the RT Server about creating a Person object: {"created":1629198963000,"name":"Bob","___class":"Persons","ownerId":null,"updated":null,"objectId":"60CE33E0-2614-47C8-B124-BB3728F87211"}
• created a new Person object: {"created":1629198963000,"name":"Bob","___class":"Persons","ownerId":null,"updated":null,"objectId":"60CE33E0-2614-47C8-B124-BB3728F87211"}
• update the Person object: {"created":1629198963000,"name":"Nick","___class":"Persons","ownerId":null,"updated":null,"objectId":"60CE33E0-2614-47C8-B124-BB3728F87211"}
• ---> RT Event <---: receive a new event from the RT Server about updating a Person object: {"created":1629198963000,"name":"Nick","___class":"Persons","ownerId":null,"updated":1629198964000,"objectId":"60CE33E0-2614-47C8-B124-BB3728F87211"}
• updated a new Person object: {"created":1629198963000,"name":"Nick","___class":"Persons","ownerId":null,"updated":1629198964000,"objectId":"60CE33E0-2614-47C8-B124-BB3728F87211"}
Regards, Vlad