I'm using Agora.io to create video chat between two people. On server side, I have recorder plugin that is used to record all chats between users.
My question is can I get notified some how (or create some listener) when channel is created so I will start recording? I need to get such notification from agora server and not from client if possible
Thanks
Implementing the recording really depends on how you want to implement it. Channels (within the Agora.io platform) don't have a "ready" state. Once a user joins the channel, the channel now exists, first user to join the channel is a broadcaster (unless explicitly set as a viewer prior to joining a broadcast channel)
Regardless of the logic you choose to implement, with all of the Agora.io SDKs there is a callback event for when the local user has joined the channel and one whenever a remote user joins a channel, so you decide when to programmatically call the recording server.
Related
Through Hazelcast's Java client I am able to successfully add an EntryListener and the listener is called as expected when entries are added or updated. So far so good.
But sometimes the client application becomes disconnected from the cluster. When this happens the client often reconnects automatically and the client has to once again add the listener. But during this brief period (between disconnection and adding the listener again), there is a chance that events are missed.
Another time that events maybe missed is if the client needs to be restart.
Is there a way to guarantee that an EntryListener receives all events?
Event listeners work in a fire&forget manner, so there is no way to receive past events.
However; there's ReliableTopic, which stores the last N events in a ringbuffer. And if you listen it with a ReliableMessageListener, it can store the event id's locally and resume from the last received event in case of a disconnection etc. Please check out the interfaces of those two.
I want to implement push notification in java so please help me out
1-Each time a new record(Message) pushed into data base(due to event created by some other user), a push notification should be sent to specific Logged in user automatically.
2-Content of the push notification should be the message present in the db.
3-If there are multiple messages, then the user should receive them one by one in a queue fashion.
4-Most important thing is the logged in user need not have to trigger any event to get notification, user should receive it automatically throughout the session.
You could use Server Sent Events. Java provides SseEmitter to send timely notifications.
You can use EventSource API in JavaScript to trigger the SSE event stream and in the server-side, loop the database query code which is wrapped by an ExecutorService - which can spin of separate thread based on the initialization.
Put SSE timeout to -1 for listening for an infinite amount of time.
Please note this answer is only a hint. Use these to explore more from the internet.
I want to pass some message between two communicating channels in call, My requirement is two java applications will act as two different users in a call, There should be some message that can be shared only between two channels in specific call, so that if one application is going to play something it can send message saying that you record now and vice-verse. I will be thankful if somebody can help me out.
You can use AMI to watch for UserA trying to share data, and then set it on UserB's channel.
Background to this...
Sounds like a similar problem that I had. With two users in a call, I wanted user A to start recording the call. I wanted the recording to start on User B's channel so that if the call was transfer, that channel was not destroyed and the recording would continue. Simply calling MixMonitor starts the recording on the channel that calls MixMonitor which would be UserA's channel.
I wrote a small application that monitors UserA and listens for a UserEvent from UserA (see 'core show application UserEvent') and then start Mixmonitor on UserB's channel. It also has to keep track of channels so that it knows which channel belongs to UserB.
I'm developing a websocket application by using Netty. I'd like to know if a message is really delivered from a source to a destination. In particular, let's assume that a client and a server have an open channel and exchange some messages for a while. At a certain point, the client goes down, but the channel is still active in Netty. I tried to use isReachable() before sending the message, but this method seems to be buggy in some scenarios (e.g. a machine with Win7 is up, but isReachable() returns false). Now, my idea is to implement a mechanism using ACKs, namely the server sends the message and the client sends back an ack. To do that, I need a timeout to see if, after a certain interval, the corresponding ack does not arrive. Is there something similar in Netty?
Regarding isReachable() - it's only a best effort API. The documentation points out that it tries to send an ICMP echo request or create a TCP connection to port 7 on the destination host, both of which are highly likely to be blocked by a firewall. Is this happening in your case?
As for the acknowledgement, there's nothing in Netty that provides this as standard, but it shouldn't be too difficult to implement. Firstly each message needs to be uniquely identifible by some sort of identifier, possibly a sequence number but a globally unique identifier means you can potentially recover across disconnections. Then you want to create a combined handler that implements both ChannelInboundHandler and ChannelOutboundHandler (assuming Netty 4). When a message is sent
add the message to a map indexed by its id
create a timer associated with the message id. Add it to another map indexed by message id
forward the message
When the ACK is received cancel the timer and remove the timer and message from their respective maps. If the timer fires use the associated id to decide what to do with the timer and message (possibly retransmit and reset the timer).
Netty provides a HashedWheelTimer for efficiently managing lots of timers with a resolution suitable for this kind of activity.
You may also want to consider putting a limit on the number of retries so you can stop and raise an error rather than continually indefinitely.
I want to notify the user of my app when he receives special news (from my app).
How can i display some kind of a messeage to the user, even if my app is running in the background (or not running at all if possible).
I want him to be notified by text, and sound.
Thanks.
You need to write a service for doing this. Then in your service code use Notification class to show text and sound alerts.
Use Broadcast Receiver, to notify abt some action. Like updates, sms, or abt indicate when booting of a phone completes,etc... BroadCast Receiver works on the principle of Publisher and Subscriber pattern.
If your app is not running and you want to do something you'll need some kind of broadcast receiver to receive a trigger.
Probably what you'll end up doing is starting up at device boot, to schedule some stuff. This answer here should get you into the right direction
After that, the best way to notify the user is with notifications (or Toast messages if you're a great fan;))
Have a look at
Status Bar Notifications