Bridge Apps

Any platform or app that supports Socket.IO could communicate with ProtoPie Connect through messages. That's where the bridge app comes into play.

A bridge app can catch events, receive data from a server, and sometimes function as a single application. Through Socket.IO, events and data can be interpreted by ProtoPie Connect.

In the example below, the bridge app receives events from the Logitech G29 through the device driver. After receiving, events are converted to JSON and delivered to ProtoPie Connect through Socket.IO.

When messages are sent to ProtoPie Connect using the JSON API, ProtoPie Connect would broadcast them to prototypes, bridge apps, and external devices. A message is of a JSON type, and the structure is as follows.

{ messageId: "messageId", value: "value", };

This is an example of messages sent to ProtoPie Connect using Socket.IO in Node.js. Have a look at the comments in the example code for more information. You can find the full source code on GitHub.

// must be installed by `npm install` const io = require(''); function main(address) { // open connection to ProtoPie Connect with address const socket = io(address); // event for socket connected socket.on('connect', () => { console.log('Socket connected', address); }); // event for socket disconnected socket.on('disconnect', () => { console.log('Socket disconnected'); }); // receive message to ProtoPie Connect socket.on('ppMessage', (message) => { console.log( 'Message form ProtoPie Connect', message.messageId, message.value ); }); setInterval(() => { // message JSON format const message = { messageId: 'time', // messageId for ProtoPie Connect value: new Date(), // value for ProtoPie Connect }; console.log( 'Message to ProtoPie Connect', message.messageId, message.value ); // send message to ProtoPie Connect with event name 'ppMessage' and message socket.emit('ppMessage', message); }, 1000); } main('http://localhost:9981');

Back To Top