I write an app flutter connect websocket. I use IOWebsocketChanel:
My code Flutter:
widget.channel = IOWebSocketChannel.connect('ws://10.2.2.89:8080/socket');
I connect success.
My code server:
#MessageMapping("/chat/message")
public void chatMessage(String message) {
simpMessagingTemplate.convertAndSend("/chat", message);
}
But my problem:
How i send message from flutter app to path "/chat/message"? What IOWebsocketChanel function?
I read docs and example. They use chanel.sink.add(message). But It not send message to path "/chat/message"
Please help me.
You can check this official guide on sending messages using websockets on Flutter. I recommend using web_socket_channel package for this use case.
Related
I'm creating an app in flutter that toast the sms whenever a sms received on the mobile. I have no idea how to do this. Can someone help me with this.
In flutter, if you want to achieve this kind of functionality than you need to use this plugin.
[https://pub.dev/packages/sms][1]
in this, you need to listen to on SMS received,
and message you will receive like this
need to add this in the main function
SmsReceiver receiver = new SmsReceiver(); receiver.onSmsReceived.listen((SmsMessage msg) => print(msg.body)); }
But please make note that it will only work when your app is in foreground or background, if its destroy then it not be work
I try to use laravel echo so I apply it I am supposed to work
knowing that I try to send a massdge to the internet it appears in blade that it is working but the application does not deliver anything what should I do to play it on the app?
https://www.mediafire.com/view/db9ozz8i7gpzqll/d.jpg/file
I'm trying to send SMS from my flutter app when a button is pressed. I'd like to do this without user interaction. I know i can launch the SMS app using url_launcher.
I tried using the sms package from pub but flutter says the api is outdated.
I'd like to do this purely in dart if possible.
I'm using the package sms_maintained. refer to package for latest version.
Code sample from package.
import 'package:sms/sms.dart';
void main() {
SmsSender sender = new SmsSender();
String address = someAddress();
...
sender.sendSms(new SmsMessage(address, 'Hello flutter!'));
}
I't provides other methods as well.
Querying, filtering, contact info, receiving and deleting as well.
For sending the a sms you'd need the necessary permissions.
SEND_SMS
And for other functionalities.
RECEIVE_SMS
READ_SMS
READ_CONTACTS
An extensive list of them are located here.
flutter AndroidManifest.xml is location => android/app/src/main/AndroidManifest.xml
EDIT #:
The package is no longer maintained. you may manually link to files from this repo
pubspec.yaml
dependencies:
...
sms_maintained:
path: plugin_folder_path
I'm using Ably to implement Pub/Sub in my application but I'm getting no errors but at the same time I'm not receiving any published messages. I'm not sure what's wrong. Help appreciated.
Here's my code:
//publisher
var Ably = require('ably');
var apiKey = '';
var ably = new Ably.Realtime({key: apiKey});
var pubChannel = ably.channels.get("sports");
setInterval(function(){
pubChannel.publish('update', {'Team': 'Man United'})
},1000)
//subscriber
var apiKey = '';
var ably = new Ably.Realtime({key: apiKey});
var subChannel = ably.channels.get("Sports");
subChannel.subscribe(function(msg){
document.getElementById('text').innerHTML = JSON.stringify(msg.data);
})
(disclaimer: I am a developer advocate for Ably, and posting and self-answering a commonly asked support question here on Stack Overflow so our users can find this more easily)
Here's what I found as a general debugging process:
First, make sure the channel you're publishing on is the same channel you're subscribing to. (Ably channel names are case-sensitive -- sports is a different channel to Sports).
Second, make sure you're using the same app everywhere (make sure you're not, say, publishing with an api key from your Sandbox app, but subscribing with an api key from your Production app)
Thirdly, you need to find out whether the problem is on the publishing or the subscribing side. Open the dev console, attach to the channel that you're publishing on, and try a publish. Do you see the message appear there (but still not on your subscribing device)? If yes, the problem is on the subscribing side. If no, the problem's on the publishing side.
Debugging publish problems
When you call channel#publish, you can pass a callback (or equivalent - select the language you're using from the language bar), which if the publish failed will tell you why.
Debugging subscribe problems
Check the connection state, make sure you're connected to Ably
Check the channel state, make sure you're attached to the channel
Make sure you've added a subscribe listener. If you added a listener for a specific event name, make sure you're publishing with the exact same event name
Hi guys i am developing chatting application using xmpp smack
in that i am using stream management when i send message i got like this from server
SENT (0): <message id='sqn7K-7' to='user4#mobizz.com' type='chat'><body>fdf</body></message>
RCV (0): <a xmlns='urn:xmpp:sm:3' h='1'/>(need to catch this h value)
i need to catch that acknowledgement for showing single tick mark like whatsapp
for that i am using below link
http://linyu19872008.iteye.com/blog/1845543
but its not working
i am struck here can any one suggest me
Thanks in adavance
naresh
You don't need that value when using Smack 4.1. Use the StanzaAcknowleged listeners.