MessagingService in NodeJS (But only for ROBLOX Studio)

A Node.js wrapper for interacting with the Roblox Message Router API.


AboutInstallationDocsCredits

About

RbxMessagingService is a node module that That allows you to use MessagingService outside of Roblox.

This project was created because people outside ROBLOX always want to use MessagingService outside ROBLOX.

RbxMessagingService allows you to do things you would normally do on the Roblox MessagingService through a Node.js interface.

Installation

With node.js installed simply run:


# Run this to install RbxMessagingService locally to your repository.

$ npm install @mfd/rbxmessagingservice --save

# Run this instead to install RbxMessagingService globally so you can use it anywhere.

$ npm install @mfd/rbxmessagingservice -g

That’s it!

Documentation

You can find the current RbxMessagingService documentation here (Roblox Wiki) or here (API Reference)

Initial setup

  1. Run RbxMessagingService.InitializeAsync with the parameters of Cookie and PlaceId. This will store your cookie internally and validate it, but will perform no cookie refresh automatically, it also requires that your cookie have the warning and be valid.

  2. While this works, Roblox .ROBLOSECURITY cookies expire after 30 years of first authenticating them.

  3. You need to store this new cookie somewhere - whether it be in a database, or a JSON file.

Note: By default, InitializeAsync will validate the cookie you provide by making a HTTP request.

Example

This example makes use of the new async-await syntax.


const { MessagingService, InitializeAsync } = require('@mfd/rbxmessagingservice');

async function startApp() {

    await InitializeAsync(

        '_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_...',

        123,

    );

    // Do everything else, calling functions and the like.

    await MessagingService.SubscribeAsync('TopicExample', function (message, sent) {

        console.log(`Message for TopicExample: ${message}, sent at: ${sent}`);

    });

    await MessagingService.PublishAsync('TopicExample', 'Some EPIC data!');

}


So yeah, I made this, it is a wrapper for MessagingService, people thought it was impossible, the only issue is that it only works for Studio communication, because I have no idea what the release X-Roblox-ChannelType is. If anyone knows what it is, help me. But here you go anyway!

9 Likes

Someone help this god sent man get the channel for live games :worried:

iirc doesn’t messaging service require you to join a game? Also, I don’t really feel comfortable with this. I know it is open-sourced, but that doesn’t mean the code is safe. To update packages you have to use a CLI and as far as I know, GitHub doesn’t have one on their website.

Bruh you don’t, it uses messagerouter.api.roblox.com/v1/router/signalr, it uses the same methods as the actual MessagingService, it uses the SignalR hub MessageRouterHub

1 Like

To publish NPM packages inside GitHub, you can set up GitHub Actions to run when any new release gets made (or from any other trigger for that matter). There, you can pick your VM’s OS, where you can use its console - so, of course, you can use npm publish with a token from the project’s secrets.

To view the source of NPM packages, install them and open your node_modules folder inside your Node project directory, where you can navigate towards it.

I got that, but you still can edit code. If you have it downloaded, you just run npm publish.

Dang it you beat me to it XD
I began working on something similar 3 days ago but got stuck at the websocket data.

1 Like

That’s how open source works, of course people edit code. As an example, look at:

A huge part of the modern web uses this library. It’s open source. If it was unsafe, people would’ve found out. Instead, users open Issues and Pull Requests to make it better. I encourage you to have more faith in open source. If you don’t trust something and you review the code, then deem it is unsafe, don’t use it! (You can also report it.) If others can contribute it doesn’t necessarily mean all repositories are harmful. It is up to the repository’s owner if pull requests get merged or denied.

2 Likes

It’s probably worth noting that this entirely relies on an internal API which has the potential to be very volatile and could change at any moment without notice. In a production app you probably want to avoid relying on APIs like these as much as possible.

1 Like

Bravo, this is amazing. :clap:

3 Likes