Passing Local Storage to Unreal Client - node.js

I'm working on a BSC blockchain game developed in unreal. The game itself right now is hosted via a NodeJS server for multiplayer purposes.
The game is a simple card game, with people being able to access special cards in-game for holding ERC20 tokens. The game will be run in a react application, either in an iframe or using the unreal HTML5 package.
There is no need to "write" to blockchain, but a permissioned read is important. Essentially, I think it makes the most sense for people to connect to the blockchain via the react app, this is something I already have. If they're connected to blockchain via the react app, and they have those ERC20 tokens, the game will let them utilize the special cards.
There aren't any plugins or straight forward solutions that I am aware of for the specific BSC/unreal combination.
I've been exploring a few ways to do this, including:
Game itself makes a Web3 request to get the data
Nodejs Authoritative Server for the game can get blockchain data, user has to pair the unreal client to the wallet (not preferable for UX)
Web3 connections are stored in browser local storage, could the unreal client detect that data from the player's specific browser if detected and load the relevant info?
Option #3 would be the most ideal, but I haven't been able to find documentation on how an unreal game could listen/fetch data on the client side for local storage such as the web3 connection.
Anyone have any suggestions or advice on what to research? Is it possible to have and unreal client pull local browser data?

Related

WebRTC through host with nodeJS express and socketio

I created a web app to let people communicate. I want to implement screen sharing and audio calls.
My current app is programmed in NodeJs and uses express and socket.io to serve the client connection and open a socket connection. I want to stream video and audio. My problem with WebRTC is that all those who connect to a call are vulnerable to a DDoS attack since it is p2p. I found an article from Discord explaining how they managed to let the entire traffic go through their servers: https://blog.discord.com/how-discord-handles-two-and-half-million-concurrent-voice-users-using-webrtc-ce01c3187429, that's exactly what I want to achieve.
Could I possibly use socket.io-stream https://www.npmjs.com/package/socket.io-stream ? I didn't yet figure out how, and it seems like all socket.io streaming libraries are made for file upload/download, not for actual video/audio streaming.
If that doesn't work, a library such as what Discord managed to make would be the perfect solution, since all traffic is proxied, and not p2p. Though I couldn't find any of those libraries, maybe I'm just looking for the wrong thing?
Best regards
You will want to use a SFU.
Each peer negotiates a session with the SFU. They then exchange media through it. Each Peer will just communicate with the server. It has lots of other benefits and is what most WebRTC deploys today use.
There are lots of Open Source SFUs out there. You can even build your own with Open Source libraries.

Is data traffic made via WebRTC measured on a platform like Heroku for example?

I want to build a Facetime clone app using NodeJS, ReactJS and WebRTC.
I am new to WebRTC and I don't know how data is transferred between clients.
My question is that if I will deploy the app on a platform like Heroku, the data transferred via video call is measured by Heroku ? That will mean huge costs to make some realtime video calls
WebRTC is peer-to-peer so would not use your Heroku data for the audio/video. Just for the matching, signing up, etc. The peers (web browsers) connect to each other and pass data directly.
However, WebRTC can only handle so many connected clients before each client cannot keep up. So a server system that relays the videos or mirrors the video (itself acting as one of the peers) would use bandwidth. But for only two videos, peer-to-peer should be ok assuming the client's bandwidth is sufficient.

Advice on how to design a good architecture for a chat app?

Hello I'm going to implement a social chat app that I what it to meet some requeriments but I'm not sure how to achieve this.
Required:
The app "frontend" should be written in React Native
Support end to end encryption
Support user to user chats
OAuth2.0
Push notifications
History
Django or Node backend
The problems comes in the backend design. I'm thinking on Node.js with websockets or Django with channels but I don't know which is a good DB design to store chats (like telegram) nor how to build a message queue.
Can anyone give me some tips on the design of a chat app? Thanks
Here is my advise
You actually have 3 choices:
Build everything from scratch (as you wrote in your initial question).
It's actually does not matter here will you use Node.js Websockets, Django Channels or Rails Action Cable. They will have pretty the same performance (or maybe Node.js will be a little bit better). You also can use any DB for this: MySQL, PostgreSQL or MongoDB.
For example, you can have these DB tables structure:
Conversations
id
created_at
updated_at
type
name
description
avatar
participants_ids
last_message_id
owner_id
unread_messages_count
Messages
id
created_at
updated_at
conversation_id
text
sender_id
recipient_id
attachments_ids
read_ids
delivered_ids
Users
id
created_at
updated_at
login
fullname
avatar
Attachments
id
created_at
updated_at
type
link
Then, all your users will have a persistent websocket connection with your server and will use it to send/receive messages. Your server will store all messages in DB in appropriate tables.
Also, you Server will provide REST API to retrieve a list of conversations, messages, attachments, other users profile.
I would say, this option is for small load, small amount of users (because of chosen technologies (Node.js/Python/Ruby) and also because you will build it by yourself, not sure you have enough experience in real time apps building)
Use some open source Chat server, like Ejabberd, Tigase, Openfire. They actually already implemented all real time chat things and have good high-load capabilities (people spent 10 years for building them). You just need to integrate them with your App Server.
Probably your App server will provide REST API to retrieve a list of conversations, messages, attachments, other users profile.
Chat server will provide a way to connect, send/receive messages. You also need to write a plugin for chosen Chat server which will track all messages and put them in you Server App DB.
Use some ready to go Cloud Messaging platforms. There are also many examples in the wild, e.g Twillio, ConnectyCube, Layer etc.
For example - ConnectyCube - Messaging and Video calling provider with messaging capabilities, user base, push notifications, video calling, chat bots. You can integrate your App Server with its REST API. Or even do not write your own App Server at all and use completely this platform. Hence save lots of time and money.
With such platforms you do no care about server hosting, server monitor, server up-time and others server related stuff, you just use their APIs and SDKs in your app. Mostly such platforms provide FREE plans along with dedicated Enterprise solutions where you own your data (it is deployed on your own AWS account for example). So highly recommended.
So something like these is possible in your case.
Here is a tutorial of AWS. It uses Node and Redis as the backend.
I followed the tutorial and built a online chat app, which fulfills all your requirements except for the first one because my app only needs web clients.
BTW, I used Redis to do clustering and DynamoDB to save all messages because I am not quite sure about the reliability of Amazon ElastiCache for Redis. In my test Redis works well and it didn't lost any message in 3 months, but my workmates insist that Redis is not reliable(well, they did not provide any data to prove that), as a result I added DynamoDB to ensure the reliability.

Meteor.js: is the DDP implemenation suitable for an inbox-messaging apps?

I'm looking at Meteor to build a site that is comparable to a stripped-down Facebook. i.e.
It will have users that can connect to other users (either by 'friending' and / or 'following')
users can interact with content that either they or other users create/share
I would like to implement a 'wall' and 'news feed' like concept
The first thing you notice on the framework is how data syncs instantaneously across all clients. I'm assuming this is what the framework refers to as 'DDP'? (Please let me know if that is not correct).
Question:
Is this 'DDP'-like thing reliable enough to build an 'inbox' messaging functionality (i.e. Facebook messenger)?
DDP(roughly) is an efficient combination of some XHR techniques and web socket. And Meteor is a framework to build programs using DDP. You can check the specification.
DDP is a protocol between a client and a server that supports two operations:
Remote procedure calls by the client to the server.
The client subscribing to a set of documents, and the server keeping the client informed about the contents of those documents as they change over time.
If your application needs reactivity and you decides not to use Meteor, you are likely to invent a layer between client and server, which is very similar to DDP.

Please Explain Google talk's working as a p2p Application

I was going through some article and found that chat Clients are mostly p2p. If Google Talk is a p2p client then how is it able to save our chat in Gmail ?
The simple answer is that the audio is streamed from browser to browser without any server in between using the Jingle protocol.
So things like text chat and audio chat is peer-to-peer whereas all other functionality is provided by Google servers.
he chat it self uses Jabber (XMPP), but conversation logs are automatically saved to a Chats area in the user's Gmail account. This means that chats involve three parties (your computer, your mates computer and Googles Gmail server cluster)

Resources