Is it possible for Pusher to support a transport payload in a non-ASCII (JSON) format?

Currently, my method of sending messages to Pusher in .NET is like the following:

var result = pusher.Trigger( "channel-1", "test_event", new { message = "hello world" } );

The way I receive them in JavaScript is as follows:

var pusher = new Pusher('APP_KEY');
var channel = pusher.subscribe('channel-1');
channel.bind('test_event', function(data) {
        // process
    }
);

I am wondering if there is a possibility to send the payload in a different (smaller) format, such as Protocol Buffers?

Answer №1

Sending binary data can be challenging because the information is typically handled as a string field in JSON objects or query string parameters when utilizing the POST method with Pusher. For more details, refer to the HTTP API reference.

If you need to send binary data, one approach is to encode it using protobuf and then convert the resulting binary into a string using a base64 encoder.

However, there may be issues with the .NET library as it encodes the data as JSON internally when sending it as an object. To work around this, consider directly posting to the HTTP API or modifying the .NET library to support a trigger method that accepts a string instead of an object.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to perform nested association counting in Sequelize?

Exploring ways to tally product reviews within nested associations using a specific query. const user = await User.findOne({ where: { id: req.query.user }, attributes: ["id", "name"], include: [ { model: Category, as: "interest ...

How can I update getServerSideProps using a change event in Next.js?

Currently, I am faced with the task of updating product data based on different categories. In order to achieve this, I have set up an index page along with two components called Products and Categories. Initially, I retrieve all products using the getServ ...

What is the reason why using slice(0,-1) does not remove just one element from an array

I am facing an issue with deleting the last number in a string. When I try using .pop, it removes all instances of the number. For example, if my array is ["12","+","12"], using .pop will remove both 12s when I only need to remove one. quene.slice(0,-1) ...

Error 403 Forbidden occurs when trying to upload a file to AWS W3 using a signed URL generated with Brightcove in Nodejs

I'm having trouble uploading a video to Brightcove by following the steps outlined in this article: Source File Upload API Dynamic Ingest The initial 2 steps go smoothly. However, when I request the S3 URLs, the response looks like this: { ...

Finding Node.js modules with a specific field: A comprehensive guide

Inquiry: What is the method to import modules that contain the example field in their package.json? Illustrative instance: const path = require( "path" ); const glob = require( "glob" ); const modules = glob.sync( './node_modules/*' ); for ( ...

With the presence of IApplicationBuilder within the .NET Framework

I'm facing a challenge trying to incorporate specific .NET Core features into my aging Webforms application. My ultimate goal is to transition to .NET Core without continuing to use outdated code. Currently, when utilizing Microsoft.Owin.Host.SystemW ...

issue with the submit button due to non-functional base64 encoded image

After successfully converting multiple file images to base64 format, I encountered an issue when trying to submit the values. When a user selects multiple images and clicks the submit button, the converted base64 values are returned as undefined. How can t ...

JQuery UI Autocomplete - Issue with loading data object

I've been attempting to implement autocomplete with JQuery UI, but I'm encountering difficulties when passing in a label & value object. var individuals = []; var test = new Array(); var dataObject = jQuery.parseJSON(data) ...

Issues with ASP.NET Gridview Paging and Sorting events not functioning as expected

I have a gridview that displays ticket data and can switch between different sqldatasources based on user actions. Below is the markup for the gridview: <X:GridViewX ID="gvxTaskList" runat="server" AllowPaging="True" AllowSorting="True" AutoGenera ...

Create an event listener for clicking on an image that potentially has a corner ribbon obscuring a portion of it

In my project, there is a div element with an id of items containing several bootstrap cards. Each card includes an image tag and some are accompanied by the following HTML code: <div class="ribbon"><span>Sale</span></div> This co ...

Is there a workaround to hide the HTMLDivElement object retrieved by Jquery/Javascript div selection using .each() method, instead of getting an Object object?

I currently have 5 div elements with the attribute data-role="content". To select all of them, I used the following code: a = $('div[data-role=content]') When I attempt to hide all the div elements by iterating through a, an error occurs. < ...

There is a chance that the object could be null. Error code TS2531 occurring in React with TypeScript

I'm currently working on an application using React and TypeScript. However, I encountered an error when trying to use .innerHTML or innerText: An error stating 'Object is possibly null' with the code TS2531 appeared. I am new to TypeScript ...

Calculating the average of two values input from separate textboxes and displaying the result in a third one

protected void TextBox6_TextChanged(object sender, EventArgs e) { if (!String.IsNullOrEmpty(TextBox4.Text) && String.IsNullOrEmpty(TextBox5.Text)) { TextBox6.Text = Convert.ToString(Convert.ToInt32(Te ...

Creating HTML dynamic lists that remain fixed to the bottom of the viewport, regardless of any changes in their content

I want to create a dynamic list that displays like this - <div class="list-wrapper"> <ul class="list"> <li class="list-item"> ... </li> <li class="list-item"> ... </ ...

What methods can be used to boost performance while loading models in three.js?

Currently, I am facing a challenge with loading .stl files into my viewer. My goal is to utilize the orbit controls provided by three.js to enable users to navigate around the file and view it from various perspectives. While the models do load successfull ...

Choose a shade from Three.js' color selector

Currently working on a project using A-FRAME, I am in the process of creating a menu for hololens. However, I am facing some challenges with a color picker. I have developed a color picker (link: Color picker) and my goal is to select a color and have it d ...

SQL inputs with information that updates automatically / autofill SQL input boxes

Is it feasible to create a webpage that can connect to an SQL database, retrieve information from a table, and display it in a text box based on the input provided in another text box? Essentially, I am looking for a way to enable autofill functionality. I ...

How to extract query string parameters using node.js

I'm currently working on fetching query string parameters from a URL using the node.js restify module. This is an example of the URL I am dealing with: Here is the relevant code snippet: server.use(restify.bodyParser()); server.listen(7779, functi ...

My website code being stored in cache by Chrome (as well as other browsers)

Issue: I am facing an issue with hosting a widget on my client's website where the widget needs to be different for each page. To display the widget, the client embeds a script tag on their pages. This script is loaded on every page and the content ...

Tips for utilizing RadGrid's features like AllowAutomaticInserts and InsertCommand

As a newcomer to Asp.net and Telerik Control, I am facing an issue while using Radgrid to bind a View with schemabinding in SQL Server. I want to utilize Telerik Radgrid's AllowAutomaticInserts/updates/deletes functions, but I am not getting any resul ...