I have usecases where a moderator can stop video of a client but not audio, and a case where only audio to be disable but not the video.
I have seen moderator documentation, but it seems it will disable the both audio/video for the client.
The moderator token let's you disconnect other clients, not mute them.
If you want to mute other clients or perform any other actions, you can leverage the Opentok Signal feature (https://tokbox.com/developer/guides/signaling/js/), and send a signal to all clients that you want to mute.
For example:
// Moderator side
session.signal(
{
data:"muteAll"
},
function(error) {
if (error) {
console.log("signal error ("
+ error.name
+ "): " + error.message);
} else {
console.log("signal sent.");
}
}
);
// Client Side
session.on("signal", function(event) {
console.log("Signal sent from connection " + event.from.id);
// Process the event.data property, if there is any data.
if (event.data === "muteAll"){
publisher.publishAudio(false);
publisher.publishVideo(false);
}
});
I hope it helps
Related
The DOC says:
Note: If your add-in calls saveAsync on an item in compose mode in order to get an item ID to use with EWS or the REST API, be aware that when Outlook is in cached mode, it may take some time before the item is actually synced to the server. Until the item is synced, using the itemId will return an error.
As best I can tell, that's the cause of my ErrorItemNotFound problems trying to use that ID? (It's a shame Microsoft did not specifically tell us what error to expect).
Since my code is invoked asynchronously - how exactly do I wait for the noted "some time"? Do we set a timer to re-try every second or something? When do we give up?? Is there something else I can do which will give me a call-back to continue when the item sync has completed? [FYI - even waiting 10 seconds after the save does not work for me]
Be aware that I expect my users may be composing mail with large attachments, so while most no-attachment messages should sync in less than 1 second, folks attaching large pdf/zip/etc files could easily cause more than 1 minute delays here...
The best what you could do is to start polling for an item appeared on the server side. For example, you may try an ugly solution when you use sub-sequential EWS query with Id you've got from saveAsync in the loop and wait for success.
For example, I've noticed the following example how developers try to handle such scenarious:
app.makeEwsRequestAsync = function (request, callback, countRepeatIfCrash, callbackIfCrash) {
try {
Office.context.mailbox.makeEwsRequestAsync(request, function (asyncResult) {
try {
if (asyncResult.status !== 'succeeded') {
app.showError(asyncResult.error.message);
return;
} else {
var $result = app.getResponseElementByName(asyncResult.value, 'm:ResponseCode');
if ($result) {
var responseCOde = $result.text();
if (responseCOde !== 'NoError') {
if (countRepeatIfCrash > 0) {
setTimeout(function () {
app.makeEwsRequestAsync(request, callback, countRepeatIfCrash - 1);
}, 500);
} else if (callbackIfCrash) {
setTimeout(function() {
callbackIfCrash();
}, 500);
} else if (responseCOde === 'ErrorItemNotFound') {
app.showError('EWS ' + responseCOde, function () {
app.makeEwsRequestAsync(request, callback, 70);
});
}
else {
app.showError('EWS ' + responseCOde);
}
return;
}
}
}
callback(asyncResult);
} catch (e) {
app.showError(e);
}
});
} catch (e) {
app.showError(e);
}
}
See App for Outlook: EWS request failed with item Id returned by item.saveAsync on compose new message for more information.
You may also can try using the simple GetItem request:
<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
<ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
</ItemShape>
<ItemIds><t:ItemId Id="' + itemId + '"/></ItemIds>
</GetItem>
The request should return ChangeKey if item was created on exchange.
I have a websocket stream being listened:
widget.channel.stream.listen((data) {
print("!!!!new msg: $data");
var dataJson = json.decode(data);
print(dataJson["content"]);
// do my job
setState(() {
_allAnimateMessages.insert(0, newMsg);
});
newMsg.animationController.forward();
});
But, when enter that page again, there was an error says:
Bad state: Stream has already been listened to.
How to make it as broadcast and other pages can receive that broadcast?
Solution for package web_socket_channel:
final channel = IOWebSocketChannel.connect(socketUrl);
final streamController = StreamController.broadcast();
streamController.addStream(channel.stream);
After that simply use streamController.stream to listen web socket events.
You can use broadcasts.
//Here is the solution
StreamController<String> streamController = new StreamController.broadcast(); //Add .broadcast here
//Now you can listen from various places
#override
void initState() {
super.initState();
print("Creating a StreamController...");
//First subscription
streamController.stream.listen((data) {
print("DataReceived1: " + data);
}, onDone: () {
print("Task Done1");
}, onError: (error) {
print("Some Error1");
});
//Second subscription
streamController.stream.listen((data) {
print("DataReceived2: " + data);
}, onDone: () {
print("Task Done2");
}, onError: (error) {
print("Some Error2");
});
streamController.add("This a test data");
print("code controller is here");
}
Font: https://medium.com/#ayushpguptaapg/using-streams-in-flutter-62fed41662e4
When using broadcasts you can have multiple listeners in the same stream.
If you simply use a stream without ".broadcast ()" you can only have one listener
As there are no useful answer, I update my answer here for other reference.
duplicate subscribe stream is a desired behaviour in flutter.
if you are just using a StreamBuilder, the stream can be listen only once. think about it, if your stream can be listen to many other pages or widgets, then data would be repeated.
But if you want using one single stream, and update all widgets
this is really can be occured when develop a complicated app, for example, you are building a chat app, new message comes, you should update many pages UI (your dialog chat ui, your session list ui....), then you should subscribe this streams in many pages, I still not found a proper way to do this, except make this stream to be broadcast, and do your work.
I have been using Botkit Facebook Messenger and I can receive text messages from Facebook perfectly, however I can not capture audio messages, images or attachments.
Has anyone been able to capture these types of messages?
var Botkit = require('botkit');
var controller = Botkit.facebookbot({
access_token: process.env.access_token,
verify_token: process.env.verify_token,
})
var bot = controller.spawn({
});
// if you are already using Express, you can use your own server instance...
// see "Use BotKit with an Express web server"
controller.setupWebserver(process.env.port,function(err,webserver) {
controller.createWebhookEndpoints(controller.webserver, bot, function() {
console.log('This bot is online!!!');
});
});
// this is triggered when a user clicks the send-to-messenger plugin
controller.on('facebook_optin', function(bot, message) {
bot.reply(message, 'Welcome to my app!');
});
// user said hello
controller.hears(['hello'], 'message_received', function(bot, message) {
bot.reply(message, 'Hey there.');
});
controller.hears(['cookies'], 'message_received', function(bot, message) {
bot.startConversation(message, function(err, convo) {
convo.say('Did someone say cookies!?!!');
convo.ask('What is your favorite type of cookie?', function(response, convo) {
convo.say('Golly, I love ' + response.text + ' too!!!');
convo.next();
});
});
});
there is an example for stickers, images, and audio replies in the facebook starter project: https://github.com/howdyai/botkit-starter-facebook/blob/master/skills/sample_events.js
If you have trouble using them, feel free to create an issues on the github!
I'm running two separate node.js processes. One runs Socket.IO and another Express.js. I'm trying to send an event from Express to the server running socket.io but by using socket.io-emitter a event only reaches sockets connected to the socket.io server. What I need is to be able to observe the same event that all other sockets are receing but on the socket.io server.
I used node_redis for interprocess communication. There's a Publish/Subscribe feature which is just what I wanted.
There's an example as below in https://github.com/NodeRedis/node_redis.
var redis = require("redis");
var sub = redis.createClient(), pub = redis.createClient();
var msg_count = 0;
sub.on("subscribe", function (channel, count) {
pub.publish("a nice channel", "I am sending a message.");
pub.publish("a nice channel", "I am sending a second message.");
pub.publish("a nice channel", "I am sending my last message.");
});
sub.on("message", function (channel, message) {
console.log("sub channel " + channel + ": " + message);
msg_count += 1;
if (msg_count === 3) {
sub.unsubscribe();
sub.quit();
pub.quit();
}
});
sub.subscribe("a nice channel");
I am using Parse.com to send push notifications via Cloud Code. These notifications are "send to sync" so I want them to be collapsible. Collapsible means that if a device is turned off or otherwise not receiving push notifications, that these notifications should not build up. When my phone turns on, I don't need a bunch of undelivered pushes showing up telling me to sync. All I need is one. I see no way to do this in Cloud Code. Is there a way to make your push notifications collapsible? Here is my CloudCode.
Parse.Cloud.afterSave("Tagnames", function (request) {
//Get the Customer that is pointed to in the AlarmDefinitions object.
query = new Parse.Query("Customers");
query.get(request.object.get("customer").id, {
success : function (cust) {
//We have the customer pointed to by the AlarmDefinition.
//Create the json payload data we will send to our clients.
console.log("Customer=" + cust.get("customer"));
console.log("action:" + "com.jrb.scadaalarm.rcvr.UPDATE_TAGNAMES");
//send the push so that all customers can get notified.
Parse.Push.send({
channels : [cust.get("customer")],
data: {
action: "com.jrb.scadaalarm.rcvr.UPDATE_TAGNAMES"
}
}, {
success : function () {
// Push was successful
console.log("Push successful.");
},
error : function (error) {
// Handle error
console.error("Push failed: " + error.code + " : " + error.message);
}
});
//
},
error : function (error) {
console.error("Got an error " + error.code + " : " + error.message);
}
});
});
Unfortunately, it doesn't look like Parse supports stackable notifications. Take a look at this answer here, from the Parse archives.
https://parse.com/questions/android-stack-push-notifications