message from ROSbridge server to client - tcp

Is it possible to send messages from the ROSbridge server to a connected client? I've connected an Android application using tcp, and able to send JSON messages from the app to the server. But is it possible to send messages in the other direction as well?
Thanks

as in the tutorials you create a websocket by starting rosbridge. You would have to consume that socket. Not sure if rosjava can consume that for your android app

Related

Own IOT platform using websockets

I am doing an IOT platform for my final year project at university, the concept is to link an IoT device with the Platform using WebSockets. My Websocket is working very well and I can send message from server to client.
But I don't know how to connect two clients to send messages to others via websocket server.
I can send message between website and server and also between my esp8266 and server.
how can I connect my arduino to the website?
Thank you
A WebSocket is basically a persistent connection between a client and
server.
In order for devices to talk with each other they first need to pass
by the server.
The server simply redirects the messages to the client that needs to
receive it.
Generally you'd have the WebSocket server in your backend.
Your frontend will be a WebSocket client.
Your device will be another WebSocket client.

How to use a client websocket to connect to a remote websocket windows server

Help needed please
What's is the best WebSocket client library for a .net 4.5 on windows web application hosted on windows 2008 servers to connect to a remote server web socket.
The scenario is: our web application will use a web socket to connect to a server WebSocket on a third party infrastructure. Our client WebSocket will connect and send some commands and read the responses where we can identify the information needed. So there is no interaction from the user or browser its just in the code. e.g. user clicks a button and we go and get some data, and give a message dependant on the response.
so for example our client will connect to the third party socket and pass the users car registration number and send a tell me the car details and the server socket will return the data like: make, model, year etc... so we can then display that to the user.
Has anyone used this library with some good success? http://www.nuget.org/packages/WebSocket4Net
I'm hoping someone here can provide the best approach for doing this with some tried and tested solutions. I have been thinking about a web API that handles all the socket stuff in our client so i can call it and let it handle the close connection etc.

signalr scaleout sending message to only particular client

As I went through the documentaion of signalr scaleout options having a backpane, i see the backpane job is to send the message from one server to all signalr servers. If so, if Server 1 wants to send message to particular client, the message goes to backpane and from there to all other servers(ex. server 2,3)..where the client 1 is connected with Server 1. So can we restrict this to send only from server1 to client 1. Also the other question, are the events like connected, reconnected also will be routed to backpane and to all other servers ?
thanks
If you are using a SignalR backplane, all messages will be sent to all servers. There is no way to configure a SignalR scaleout provider to only send messages to specific servers. It's all or nothing.
If you choose to forgo a backplane, you could of course configure SignalR to use its default in-memory message store and then manually send inter-server messages.
Events like connected/reconnected/disconnected do not involve publishing messages so no messages will be routed to all other servers.

Server-Sent Events queries

We have a requirement wherein the server needs to push the data to various clients. So we went ahead with SSE (Server-Sent events). I went through the documentation but am still not clear with the concept. I have following queries :
Scenario 1. Suppose there are 10 clients. So all the 10 clients will send the initial request to server. 10 connections are established. When the data enters the server, a message is pushed from server to client.
Query 1 : Will the server maintain the IP address of all the client? If yes is there an API to check it?
Query 2: What will happen if all the 10 client windows are closed? Will the server abort all connections after a period of time?
Query 3: What will happen if the Server is unable to send messages to client due to unavailability of client like machine shutdown. Will the server abort all connections after a period of time for those client for whom they are unable to send the message?
Please clarify?
This depends on how you implement the server.
If using PHP, as an Apache module, then each SSE connection creates a new PHP instance running in memory. Each "server" is only serving one client at a time. Q1: yes, but not your problem: you just echo messages to stdout. Q2/Q3: If the client closes the connection, for any reason, the PHP process will shutdown when it detects this.
If you are using a multi-threaded server, e.g. using http in node.js. Q1: the client IP is part of the socket abstraction, and you just send messages to the response object. Q2/Q3: as each client connection closes the socket, the request process that was handling it will end. Once all 10 have closed your server will still be running, but not sending data to any clients.
One key idea to realize with SSE is that each client is a dedicated socket. It is not a broadcast protocol, where you push out one message and all clients get exactly the same message. Instead, you have to send the data to each client, individually. But that also means you are free to send customized data to each client.

Chat Application in ASP.NET

I've to write an Ajax chat web application in ASP.NET for a friend, and I've a question: if client1 sends a message to client2, how should the application send the message to client2? Is there a better way than sending requests to the server, "asking" if there are new messages? Is it possible to directly send the message to the client?
Best thing you can do is use a Persistent HTTP Connection. The way google does with Google Talk on their GMAIL website.
Remember that HTTP is a stateless protocol and that each transaction is made from the client to the server.
The server can use sessions to determine if this client is "known" but as for sending information back to the client using plain old HTTP I think that is impossible (I mean from a server initiated connection, not a response to the client)
You would need to use Javascript to poll the server for information.
If you want it the other way around, you could possibly use Java or Flash but then you also need to think about NAT tunneling, proxy servers and any other weird setups that the clients could be using.
No. I don't think the server can send message to client's browser.
Here is how I implement chat application:
client1 post message via Ajax to server
server save it to repository (I'm using singleton object for this case)
client2 get the message from repository
mark the message as read
I will save chat logs to database once the chat session closed or expired.

Resources