I'm working on a card game and it seems like actors - specifically remote actors - would be a good fit. I'm having trouble figuring out how to implement the notion of logging in using remote actors. If a player starts up a fat client and enters a username and password, what should happen next? Should the client:
have a User remote actor where some state changes to represent a successful login?
call a method on an Authentication remote actor and get back a handle to a logged in User remote actor?
something else entirely?
I'm also wondering how this would fit in with reconnecting after a network issue.
Send an authentication message to a known remote actor, he responds with an actor you can talk to if successful, and a failure message if login failed. Profit
Related
Roughly speaking a HTTP SESSION is a kind of secret that the server sends to the client (ex browser) after user's credentials is checked. This secret is passed trough all subsequents HTTP requests and will identify the user. This is important because HTTP are stateless - source.
Now I have a scenario where there is a communication between a machine and a MQTT broker inside the AWS-IoT core. The machine displays some screens. The first screen is the login and password.
The idea here is that after the first screen, IF the credentials are validated, the server should generate a "session" and we should send this "session" across the screen pages. The machine should send this "SESSION" in all subsequent messages and the server must to validate this string before any action. This is a request created by an electrical engineering team.
Me, in the software development side it seems that make no sense since all machines to be connected in the AWS IoT-Core broker (MQTT) must to use a certificate - with is the validation already.
Beside of that, the MQTT broker offers the SESSION persistence capabilities. I know that the SESSIONs (QoS 0/1) in the broker side are related to idea of confidence of delivery and reception of a message.
That being said is it possible to use session persistence in MQTT to behavior like a sessions in HTTP in order to identify users across screens in devices? If yes how?
No, HTTP Session concept is not in any way similar to the MQTT session. The only thing held in a MQTT clients session is the list of subscribed topics, a HTTP session can hold arbitrary data.
Also MQTT messages hold NO information about the user or even the client that published the message when it is delivered to the subscriber, the ONLY information present is the message payload and the topic it was published to.
While MQTTv5 adds the option to include more metadata, trying to add the concept of users sessions is like trying to make a square peg fit in round hole.
If you want to implement something as part of the message payload then that is entirely up to you, but it is nothing to do with the transport protocol.
I am setting up a quorum network with two nodes from the scratch which are using the RAFT consensus mechanism. The two nodes are live, up and running. One is specified as minter and the other is verifier. I have deployed a smart contract into the private quorum chain network using the Truffle framework.
I was able to add the contract token and account info to Metamask and retrieve corresponding ETH balance and token balances.
However, when I tried sending normal Ether between two accounts using Metamask (by using the accounts connected to Quorum chain), the transaction fails with the following message
MetaMask - RPC Error: Error: [ethjs-rpc] rpc error with payload {"id":6378119053557,"jsonrpc":"2.0","params":["0xf88b17850af16b1600830f424094e8bd1fc300c3cd85bf033a13effe02226d22e76280a4c6ed8990000000000000000000000000000000000000000000000000000000000000000a82f4f5a04e31045bf76c16a594ee742be05909019bfe31b0c57cca66918b13898b3684fda023aa10926436f4eec79d2a08407a55ba35d1dad4d50d9029dc26d7d7629bfabf"],"method":"eth_sendRawTransaction"} [object Object]
I have been trying to debug this error for a while but no success whatsoever. Requesting experts for help on this!
Thanks!
This happen with me sometime.I tried a lot of things but easy one is:-
Go to:-
Setting > Advance >Reset and reset account.
Note:-Resetting your account will clear your transaction history. This will not change the balances in your accounts or require you to re-enter your seed phrase.
What can be the reasons that cause a socket.io session to be crashed and server returns invalid session or session is disconnected ?
There is a specific situation that causes these problems with the session. When a client fails to send the pings at the expected interval the server declares the client gone and deletes the session. If a client that falls into this situation later tries to send a ping or another request using the now invalidated session id it will receive one of these errors.
Another possible problem with the same outcome is when the client does send the pings at the correct intervals, but the server is blocked or too busy to process these pings in time.
So to summarize, if you think your clients are well behaved, I would look at potential blocking tasks in your server.
Ok, I'll illustrate my problem in this figure project's architecture .
In fact, I have a websocket between the react app and the rasa ( tool for creating chatbots) based on flask. bot response need to access to an external API to retrieve some data. Here where things go wrong. Sometimes, these requests take too long to return a response, and that's when websocket misbehave.
I'm new to software development in general, and I'm writing a backend for a simple ride-sharing iOS application (which I'll develop later). I'm using Vapor to create the backend.
When a user makes a trip request to the API, I want to create a new trip and establish a websocket session between the user and a driver. The problem I'm having is how can I notify a driver that a request is in and add him to the session?
Here's what I've come up with so far, although I'm not sure if it's going to work:
When a trip request comes in, I would create a session and a trip object with the session id. When a driver visits the "Trip requests" tab in the app he would make a get request to retrieve active trip requests. When he then clicks on one of the trip requests, he would make a request with the session id of that particular trip to be added to that session.
The problems I'm seeing with the above solution is that that would make the User the Poster, and the Driver the Observer, which I'm not sure is the way to go since I want the driver to act as a poster (to send location updates so that the user can track the driver on the map in real time).
Another problem is that users would have to wait indefinitely before a driver accepts their request.
Is there a better way to notify the driver of a trip request? How can I go about achieving this?
First, you will get trouble when trying to establish a direct connection between user and driver, because it's quite difficult to directly connect to an app on a smartphone (changing IPs, NAT, firewalls and opening ports are some of the problems).
I'd suggest, you implement some kind of REST API for the trips/trip requests. To notify the driver or send updates back to the user, you can either use push notifications (for iOS it's APNS) or websockets. In the best case both for different situations.
Here are some hints for further research on those topics:
WebSockets: In Vapor, an example chat app using websockets , WebSocket wrapper for Vapor
Push notifications: Gorush, push notification server, Apple Notifications, (WIP: APNS on NIO)
I hope that helps for your next steps. Your question is quite broad to be more specific.
I'm writing a chat server application where the users can exchange messages with one of his friends. When the user connects i store his connection on an class variable hash:
##connections[:user_id] = conn
When someone sends the user a message, I look for his connection on the hash and send the message through it. Sometimes the connection whith the clients simply dies, and the onclose callback is not invoked.
That works fine, and it's what I did when I started writing a web IRC client, but the problem is you're coupling your connected users to a single ruby process. If you wanted to spin up a 2nd em reactor, that 2nd process would not share the same class variables. You can get around that by using haproxy to split users between the different processes, but it's something to watch out for.