How to Broad Cast Message from JAVA server to JAVA Client in Atmosphere Framework - websocket

I am Using Atmosphere Framework web socket as my first preference for transmission fall back goes to long pooling ,
used runtime-native as atmosphere dependence for maven tool
Tomcat-v8 as a server
I could like to receive the broadcast message in Java Code so I refer to the following Links
http://blog.javaforge.net/post/32659151672/atmosphere-per-session-broadcaster
Broadcast to only one client with Atmosphere
https://github.com/Atmosphere/atmosphere
https://atmosphere.java.net/atmosphere_whitepaper.pdf
From the above links and chart samples I build the project successfully but I could like to broadcast from client to server both are JAVA Language.
Also I wrote a BroadcastFactory as
Server:
BroadcasterFactory.getDefault().lookup("URL to broadcast", true).scheduleFixedBroadcast(message, 2, TimeUnit.SECONDS);
Client
AtmosphereRequest request = atmosphereResource.getRequest();
String IncomingMessage = request.getReader().readLine();
Here while I put debug mode I got NULL as value,this made me to ask question that whether I am doing wrong or Framework doesn't support.
FYI:
I used this Link
https://github.com/Atmosphere/atmosphere/wiki/Creating-private-channel-of-communication-between-Browsers
I con't get the line
privateChannel
.addAtmosphereResource(atmosphereResource_browser1)
.addAtmosphereResource(atmosphereResource_browser2);
atmosphereResource_browser means its define browser name?
please suggest me how to proceed more,sharing of Links or video will be helpfull.Thank in Advance

No it's not the browser name but it is the the AtmosphereResource, who represent the browser/user to that Broadcaster.
If you want broadcast to limited clients then you can create privateChannel and then broadcast to that channel.

Related

What is the stucture of the elgato wavelink 1.6.2 websocket

I what to use the Wavelink WebSocket but because of the new version of Wavelink all SDKs are broken.
I already tried connecting to the WebSocket and what I found by doing this is that there are a few events that can be triggered by changing stuff in Wavelink.
Outputs
outputMuteChanged
outputVolumeChanged
selectedOutputChanged
Inputs
inputsChanged
inputMuteChanged
inputVolumeChanged
Filter
filterAdded
filterChanged
filterRemoved
But what I did not find out is what commands you can send.
I learned that you can see what commands are sent between the WebSocket and the client using Wireshark. The problem is that I don't have any device like the Elgato Stream Deck that sends Commands to the Wavelink Software.

gRPC stopped working with APO on Windows 11

I have a Windows application (APP) and Audio Processing Object (APO) loaded by AudioDG.exe that communicate via gRPC:
APP part that is written in C# creates server via Grpc.Core.
APO part creates client via grpc++.
Server is on 127.0.0.1:20000 (I can see it's up and listening with netstat -ano).
I can confirm that APO is loaded into audio device graph by inspecting it with process explorer.
Everything worked like a charm on Windows 8 and 10, but on 11 it cannot communicate at all - I get either Error Code 14, Unavailable, failed to connect to all addresses or 4, Deadline Exceeded.
After enabling debug traces, I now see "socket is null" description for "connect failed" error:
I0207 16:20:59.916447 0 ..\..\..\src\core\ext\filters\client_channel\subchannel.cc:950: subchannel 000001D8B9B01E20 {address=ipv4:127.0.0.1:10000, args=grpc.client_channel_factory=0x1d8bb660460, grpc.default_authority=127.0.0.1:10000, grpc.internal.subchannel_pool=0x1d8b8c291b0, grpc.primary_user_agent=grpc-csharp/2.43.0 (.NET Framework 4.8.4470.0; CLR 4.0.30319.42000; net45; x64), grpc.resource_quota=0x1d8b8c28d90, grpc.server_uri=dns:///127.0.0.1:10000}: connect failed: {"created":"#1644240059.916000000","description":"socket is null","file":"..\..\..\src\core\lib\iomgr\tcp_client_windows.cc","file_line":112}
What I've tried so far:
Updating both parts to the latest grpc versions.
Using "no proxy", "Http2UnencryptedSupport" and other env variables.
Using "localhost" or "0.0.0.0" instead of "127.0.0.1".
Updating connection to use self signed SSL certificates (root CA, server cert + key, client cert + key).
Adding inbound / outbound rules for my port, and then disabling firewall completely.
Creating server on APO side and trying to connect with the client in APP.
Everything works (both insecure and SSL creds) if I create both client and server in C# part, but as soon as it's APP-APO communication it feels blocked or sandboxed.
What has been changed in Windows 11 that can "block" gRPC?
Thanks in advance!
In your input you write:
Server is at 127.0.0.1:20000
Further looking at the logs, you can see that:
The server is located at
grpc.server_uri=dns:///127.0.0.1:10000
Based on the question posed and the amount of data provided, I would check which port the server is really using and which port the client is looking for a connection on.
The easiest way to do this is to use the built-in Resource Monitor application. On the Network tab, in the TCP Connections list, you can find the application and the port it uses.
You can also use the PowerShell command
Test-NetConnection -Port 10000 -InformationLevel "Detailed"
Test-NetConnection -Port 20000 -InformationLevel "Detailed"
At least this is the first thing I would check based on what you described.
Regarding your question about the changes in Windows 11, I do not think that this is something that's causing problems for you. However, Windows 11 has additional security features compared to Windows 10, try disabling the security features completely as a test. Perhaps this will help solve the problem.
As for ASP.NET Core 6.0 itself (if I understood the version correctly), then there is a possibility that the server part, working not in the sandbox of the programming environment, still does not accept the client certificate. At the program level, you can try to fix this by adding the following exception to the code:
// This switch must be set before creating the GrpcChannel/HttpClient.
AppContext.SetSwitch(
"System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
// The port number(5000) must match the port of the gRPC server.
var channel = GrpcChannel.ForAddress("http://localhost:5000");
var client = new Greet.GreeterClient(channel);
More troubleshooting issues with ASP.NET Core 6.0 Microsoft described in detail here.
https://learn.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-6.0
I hope it was useful and at least one of the solutions I suggested will help solve your problem. In any case, if I had more information, I think I could help you more accurately.

"SocketException: No buffer space available" on Jersey Client

I am using jersey-client (1.9) for calling api and everytime when i need to call a webservice i create a new client instance :
Client client = Client.create();
WebResource webResource = client.resource(url);
ClientResponse response = webResource
.queryParam(PARAM1, param1)
.queryParam(PARAM2, param2)
.type(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
the problem is after a period of time i get this exception :
com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: No buffer space available (maximum connections reached?): connect
If anyone could help me figure it out I would be very grateful .
You have a resource leak. (Connections and InputStreams backing ClientResponses aren't being closed.) You can read a ClientResponse entity so that its associated resources are automatically closed by calling ClientResponse.readEntity(), or you can manually close them via ClientResponse.close().
The following documentation may not exactly apply to the version of Jersey that you're using, but it's insightful:
Jersey Client API, Closing connections
If you will provide additional details about the OS (windows/linux), more of the code or the type load your service is experiencing - all would help to provide a better answer.
A good guess though is that your OS is running out of sockets ports. Different OS's have different defaults and different ways of configuring how many sockets are available to establish TCP sockets.
though not exactly the same question, this one is similar can shed some light on your situation: java.net.SocketException: No buffer space available (maximum connections reached?): connect
There is also a write up about the same exception here:
http://dbaktiar-on-java.blogspot.com/2010/03/hudson-shows-buffer-space-available.html

Is there a way to invoke the gevent-socketio BaseNamespace.emit server side

Is there a way to invoke the gevent-socketio BaseNamespace.emit on the server side since it uses environ['socketio'] to get the socket from the request.environ. How I can generate new virtual socket or emualate somehow the environ['socketio'] on the server so I can use it to invoke the gevent-socketio BaseNamespace class (for emitting a message for example).
The idea behind this is that the server itself would be able to broadcast messages on a fixed period.
Thanks

Sending image from server to client

How to send image from server to client through bluetooth in j2me?
If you are in control of both the server and client, then you don't need to worry about the complexities of OBEX. You can create your own lightweight protocol that does only what you need.
If you are new to Bluetooth on J2ME, start by reading about JSR 82. You'll want to create an RFCOMM/SPP connection between your client and server.
Next is the matter of sending an image over a serial connection in J2ME. If you have the image loaded as a javax.microedition.lcdui.Image, you'll need to obtain the ARGB pixel data using Image.getRGB().
This gives you an int array, which you'll need to send over the SPP connection (look at DataOutputStream.writeInt()), and rebuild at the other end using Image.createRGBImage().
HTH.
I've found the avetana Bluetooth libraries to be a bit unstable, and found BlueCove to be a better proposition. As mentioned, OBEX is the OBject EXchange protocol to use, and the docs are all over the internet.
If you look into "apps\BluetoothDemo\src\example\bluetooth\demo" folder of Sun WTK 2.5.x installation folder, you can find BTImageServer.java and BTImageClient.java source codes.
It uses serial profile to send image data from server to client. I think you can easily understand by looking it.
If you mean OBEX, try avetana (obex implementation on JSR-82) - it includes some example.

Resources