Issue with the realtime API endpoint

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I am trying to use the realtime.roblox.com API to receive PM messages. However, it seems as if the API no longer works.

  2. What is the issue?
    When I am using the API for my bot I get this error:
    image

  3. What solutions have you tried so far?
    I tried searching for a solution to this issue but I can’t seem to find anything. I searched the DevForum and I also searched through google and can’t find anything.

The code below is from the noblox.js onNotification event.

// Dependencies
const SignalR = require('signalr-client').client
const events = require('events')

// Includes
const getSession = require('../util/getSession.js').func
const settings = require('../../settings.json')

// Args
exports.optional = ['jar']

// Docs
/**
 * 🔐 An event for when you get a notification.
 * @category Client
 * @alias onNotification
 * @returns An EventEmitter that emits when you get a notification.
 * @example const noblox = require("noblox.js")
 * // Login using your cookie
 * const notification = noblox.onNotification()
 * notification.on("data", function(data) {
 *  console.log("New notification! ", data)
 * })
 * notification.on("error", function(err) {
 *  console.error("Something went wrong: ", err)
 *  // Handle error as needed
 * })
**/

// Define
exports.func = function (args) {
  const max = settings.event.maxRetries
  const notifications = new events.EventEmitter()
  function connect (retries) {
    if (typeof args.jar === 'string') {
      args.jar = { session: args.jar }
    }
    const session = getSession({ jar: args.jar })
    const client = new SignalR('wss://realtime.roblox.com/notifications', ['usernotificationhub'], 3, true) // wss for https
    client.headers.Cookie = '.ROBLOSECURITY=' + session + ';'
    client.on('usernotificationhub', 'notification', function (name, message) {
      notifications.emit('data', name, JSON.parse(message))
    })
    notifications.on('close', client.end)
    client.serviceHandlers.connectFailed = function (err) {
      notifications.emit('error', new Error('Connection failed: ' + err.message))
      if (retries !== -1) {
        if (retries > max) {
          notifications.emit('close', new Error('Max retries reached'))
        } else {
          setTimeout(connect, 5000, retries + 1)
        }
      }
    }
    client.serviceHandlers.onerror = function (err) {
      notifications.emit('error', err)
    }
    client.serviceHandlers.connected = function (connection) {
      notifications.emit('connect', connection)
    }
    client.serviceHandlers.reconnecting = function () {
      setTimeout(connect, 5000, 0)
      notifications.emit('error', new Error('Lost connection, reconnecting'))
      return true // Abort reconnection
    }
    client.start()
  }
  connect(-1)
  return notifications
}

Roblox notifications websocket got removed a few months ago sadly…

That isn’t true it hasn’t gotten removed because I was able to fix it and make it work.

They changed the code so it is a little different now.

it is true, the WebSocket is 404 now.

The legacy .NET one at https://realtime.roblox.com was replaced with https://realtime-signalr.roblox.com/userhub, you can connect to it with the @microsoft/signalr npm package.

but I need realtime.roblox.com/notifications back, realtime-signalr.roblox.com/userhub is useless, it has so many removed notification types that I need like voice chat…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.