I use a simple Query Code to display Toastr in my application. This is the code:
<script>
document.getElementById("test").onclick = function() {
$.toaster({
priority : 'success',
title : 'yassine Jennane',
message : 'yassine jennane test toster'
});
};
</script>
My problem is when there is another user connected in my application, he isn't receiving the notification at the same moment as the first one do. Why?
Link of the notification script + demo: jQuery & Bootstrap Based Toast Notification Plugin
This won't work like that. You need to create Event Classes and Broadcasting Channels. Further you need to have some socket.io node.js side so that the notifications are shown live on the client side.
You probably don't have experience in this subject, so I would suggest to do following things:
Have a look at following in the documentation: https://laravel.com/docs/5.7/broadcasting
Watch following tutorial on laracasts: https://laracasts.com/series/real-time-laravel-with-socket-io/episodes/1
Of course you can have a look at some other tutorials you find on the internet.
The plugin you're using is a Jquery plugin that makes toasts in user browser, it works only for connected user, if you want to show notification for all the users using your application, you should use Cloud Messaging service, Firebase is good one.
Related
We are planning to use recaptcha-V3 on our website. To try this out first and do a phased released - one suggestion was just to have the front-end integration (without backend integration for site verification) and then monitor using the reCaptcha console for unusual activities. If we find unusual activities, we'll then turn on an extra verification on the login page (controlled by a switch).
So the key question I have got is - Can we integrate recaptchaV3 only on the front-end and not on the backend - and use the Admin console to monitor activities?
Yes you can do that. without any backend integration it can be done but that will not be a good way to implement this . The secret key and as well as the request token will be exposed in client browser.
Try this code :
<script src="http://www.google.com/recaptcha/api.js?render={recaptchaSiteKey}"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('recaptchaSiteKey', {action: 'homepage'}).then(function(token) {
var recaptchaSecret={recaptchaSecret};
var responseString = "https://www.google.com/recaptcha/api/siteverify?secret="+recaptchaSecret+"&response="+token;
$.ajax({
url:responseString
//your code
});
});
});
</script>
I am creating a firefox OS application, I want the user to be able to share a link through any application installed and eligible (facebook, twitter etc). I saw android has this kind of feature and firefox OS has it as well, as I saw it in one of it's built in applications. Went through Web API, didn't find a suitable match,
Any ideas how to do it?
This is the intended use of the Web Activity API . The idea is that applications register to handle activities like share. The Firefox OS Boiler Plate app has several examples of using Web Activities. In that example a user could share a url using code like:
var share = document.querySelector("#share");
if (share) {
share.onclick = function () {
new MozActivity({
name: "share",
data: {
number: 1,
url: "http://robertnyman.com"
}
});
};
}
Any app that handles the share activity will be shown allowing the user to pick the proper app to handle the share.
I am working with web-socket project. We are tracking the customers of the website and showing that information to our customers dashbaord.
For this we are using pubnub service. They have api to subscribe and her_now to get currenly active connections. But seems it is not working properly. It is not tracking as we expecting.
It is not sending events properly when customers have lot of traffic(>150 active). And even his cost is too high.
We are planning to move to some other technique to do this. Please suggest which one is the good option.
How about nodejs with socket.io. One thing i am thinking the scalability when our customers have lot of traffic.
Please suggest on this.
Thanks,
Govind.
Move to Socket.io (It,s support mobile and all browser) and performance is good
Problems with online visitor tracking:
Here is my answer,When user visit you website you emit some event using following code
Server side:
var io = require('socket.io');
io.sockets.on('connection', function (socket) {
//From user
socket.on('userEnterYourWebsite',function(data){
//Do some DB operation means retrive user related information from DB
//If emit some data to user
socket.emit('sendToUser',{name:'mmm',state:'tamilnadu'});
});
});
Client Side:
<script>
var socket=io.connect('http://ipaddress:8080');
var userIDorUniqueID='mmmmmmm';
socket.emit('userEnterYourWebsite',{uniqueID:userIDorUniqueID});
//From server
socket.on('sendToUser',function(data){
console.log(data.state);
});
</script>
Property Annouce Max
You just need to set the Presence Announce Max property on the Presence add-on higher. Contact support#pubnub.com to set it higher than 100.
Build vs. Buy
What will be the cost of scaling your DIY node/socket.io solution? See the following before considering the DIY route.
http://www.pubnub.com/blog/build-vs-buy-why-diy-isnt-always-better/
http://www.pubnub.com/customers/swaplingo/
http://www.pubnub.com/customers/tint/
I have an task to implement an chat based application to access private data available at server using web service api call.Show all available users from web server and to chat with those persons.Is't possible with titanium development to support on iPhone/Android chat application. If possible let me guide to implement the same.
Yes, of course it's possible. And there are a million ways to do this, your question is not very clear.
If its totally web services based then just use this.
Heres a quick example of posting to a webservice and sending a JSON object:
var getChatMessages = Ti.Network.createHTTPClient({
onload : function(e) {
var doSomethignWithThis = this.responseText;
},
onerror : function(e) {
Ti.API.info(this.responseText);
Ti.API.info('SelectActivityStepsByKeyList webservice failed with message : ' + e.error);
}
});
getChatMessages.open('POST', 'http://yourchatserver/GetChats');
getChatMessages.setRequestHeader("Content-Type", "application/json");
getChatMessages.send({"message" : "How is everyone today?", "user" : "me#me.com});
This is not difficult with titanium, the hard part is on the server side.
Here is an example project that accomplishes chat through the use of the socket.io library. This may be a better approach for you. The link has a video of how it works as well as the full source code.
I'm making an app and I want to be able to go from my app to the messaging app straight to the "Create new" page. Is there a way I can navigate to that page straight from my app?
As Andrew M mentioned, the SmsComposeTask is the correct control to use. Here is some sample code for you:
SmsComposeTask smsTask = new SmsComposeTask();
smsTask.To = "0123456789"; // the number you would like to send the sms to
smsTask.Body = "Some prefilled text..."; // if you would like to fill some text
smsTask.Show();
When Show() is called, the app will navigate to the Messaging application and display an SMS filled in with the defined parameters.
Simply use the above code in an event handler (i.e., the event for when a button is clicked), and the user will be navigated accordingly.
Use the SMSComposeTask:
http://www.nickharris.net/2010/09/how-to-sms-using-the-smscomposetask-for-windows-phone-7/