- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我为每个订单的用户和供应商之间的 flutter 应用程序制作了聊天模块,但在真实的 iPhone 中,我需要返回然后打开聊天屏幕才能看到新消息,而不是实时的
我怎样才能将它转换成实时的,这样用户或供应商就不需要返回然后重新打开聊天页面来查看新消息
这是我的代码
用户聊天界面
import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'dart:convert';
import 'dart:async' show Future;
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:intl/intl.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'chat_model.dart';
import 'chatmessage.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:uuid/uuid.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
class ChatPage extends StatefulWidget {
final String _userName;
final String _id;
final String _userid;
final String _orderNo;
final String vendorId;
//widget.vendorId
ChatPage(
this._userName, this._id, this._userid, this._orderNo, this.vendorId);
StreamSubscription _subscriptionTodo;
@override
_ChatPageState createState() => new _ChatPageState();
}
class _ChatPageState extends State<ChatPage> {
static var databaseReference = FirebaseDatabase.instance.reference();
var v_id;
var vendor_id;
var user_id;
var vendor_name, vendor_token;
final TextEditingController _chatController = new TextEditingController();
final List<ChatMessage> _messages = <ChatMessage>[];
List<ChatModel> list_messages = List<ChatModel>();
DateTime now = DateTime.now();
FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
var chat_id_fr;
Future onSelectNotification(String payload) {
debugPrint("payload : $payload");
showDialog(
context: context,
builder: (_) => new AlertDialog(
title: new Text('Notification'),
content: new Text('$payload'),
),
);
}
@override
void initState() {
vendor_id = widget.vendorId;
user_id = widget._userid;
print(vendor_id + "ssssss");
getDetails();
getchat();
flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
var android = new AndroidInitializationSettings('@mipmap/ic_launcher');
var iOS = new IOSInitializationSettings();
var initSetttings = new InitializationSettings(android, iOS);
flutterLocalNotificationsPlugin.initialize(initSetttings,
onSelectNotification: onSelectNotification);
//_firebaseMessaging.setAutoInitEnabled(enabled)
_firebaseMessaging.configure(
onLaunch: (Map<String, dynamic> message) {
print('onLaunch called');
showNotification("", "");
},
onResume: (Map<String, dynamic> message) {
print('onResume called');
showNotification("", "");
},
onMessage: (Map<String, dynamic> message) {
print('onMessage called' + message.toString());
Map msg_ = message['notification'];
String body = msg_['body'];
String title = msg_['title'];
setState(() {
ChatMessage message = new ChatMessage(
text: body.toString(),
vendor: "vendor",
vendor_name: "",
);
print("msg===" + body.toString());
print("msg===" + body.toString());
_messages.insert(0, message);
showNotification(body, title);
});
},
);
_firebaseMessaging.subscribeToTopic('all');
_firebaseMessaging.requestNotificationPermissions(IosNotificationSettings(
sound: true,
badge: true,
alert: true,
));
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
print('Hello');
});
_firebaseMessaging.getToken().then((token) {});
}
showNotification(String body, String title) async {
var android = new AndroidNotificationDetails(
'channel id', 'channel NAME', 'CHANNEL DESCRIPTION',
priority: Priority.High, importance: Importance.Max);
var iOS = new IOSNotificationDetails();
var platform = new NotificationDetails(android, iOS);
await flutterLocalNotificationsPlugin
.show(0, 'New Message', '$body', platform, payload: '$body');
}
Future<String> getDetails() async {
FirebaseDatabase.instance
.reference()
.child("vendor")
.child(vendor_id)
.once()
.then((DataSnapshot snapshot) {
Map value = snapshot.value;
var vendor_id_fr = value['id'];
vendor_name = value['name'];
vendor_token = value['token'];
//Map<String, dynamic> data = map['Data'];
print("name " + vendor_name);
print("id " + vendor_id);
print("token " + vendor_token);
});
return vendor_id.toString();
}
Future<String> getchat() async {
FirebaseDatabase.instance
.reference()
.child("chat")
.child(widget._orderNo)
.once()
.then((DataSnapshot snapshot) {
Map value_ = snapshot.value;
value_.forEach((key, value) {
Map value_1 = value;
chat_id_fr = value_1['chat_id'];
var vendor_msg_fr = value_1['msg'];
var user_id_ = value_['user_id'];
var vendor_id_ = value_['vendor_id'];
ChatModel chatModel = new ChatModel.fromJson(value);
list_messages.add(chatModel);
list_messages.sort((x, y) => x.chat_id_fr.compareTo(y.chat_id_fr));
});
var list_data = list_messages.toString();
print(list_data.toString());
// list_messages=list_messages.reversed.toList();
int dfd = list_messages.length;
for (int i = 0; i <= list_messages.length; i++) {
dfd = dfd - 1;
/* var value = list_messages.reduce((curr, next) => curr.chat_id_fr > next.chat_id_fr ? curr : next);
var value1 = list_messages.reduce((curr, next) => curr.chat_id_fr > next.chat_id_fr ? curr : next);
*/
if (list_messages
.elementAt(dfd)
.for_value
.toString()
.contains("user")) {
setState(() {
ChatMessage message = new ChatMessage(
text: list_messages.elementAt(dfd).msg,
vendor: "user",
vendor_name: vendor_name);
_messages.add(message);
});
} else {
setState(() {
ChatMessage message = new ChatMessage(
text: list_messages.elementAt(dfd).msg.toString(),
vendor: "vendor",
vendor_name: vendor_name,
);
_messages.add(message);
//list_messages.reversed.toList();
});
}
}
});
return vendor_id.toString();
}
Future<http.Response> postRequest(String msg) async {
var url = 'https://fcm.googleapis.com/fcm/send';
Map<String, dynamic> jsonMap = {
'notification': {'body': '$msg', 'title': 'New Massage'},
'to':
'fPgRVKZY56Q:APA91bHEMQy1EKHbPUraCn2tCp2th6Oah5Xx_N7b-6wLiHWjjYG7WCaRmjwstR8_YaNukwA_mwZHuCpQoYKuXL7nQBMGPH3kw58vHth7FkXuyn-keW0JnNUZhDzlgV2RA9HraeW2M4R0',
};
Map<String, dynamic> jsonMap1 = {
'notification': {'body': '$msg', 'title': 'New Massage'},
'to': '$vendor_token',
};
//encode Map to JSON
var body = json.encode(jsonMap1);
var response = await http.post(url,
headers: {
"Content-Type": "application/json",
"Authorization":
"key=AAAAt08dld0:APA91bEY6Dtrb1x1SlAprnEYeSEUdCT0D0oq9qzlkLJDIJdB0-hVIbdKL_L6CysecmOb46gjD3lyZMKl5aGH4rY1daFYA838VMnS7SzumelXie3Vps7s8MkILRgz7Kj0QQ65Dp0uZLI6"
},
body: body);
print("${response.statusCode}" + "=response=");
print("${response.body}" + "=response=");
return response;
}
void _handleSubmit(String text) {
_chatController.clear();
String formattedDate = DateFormat('kk:mm:ss').format(now).toString();
var uuid = new Uuid();
var rondm_no;
var rng = new Random();
for (var i = 0; i < 10; i++) {
print(rng.nextInt(100));
rondm_no = uuid.v1().toString() + 'user_id';
}
// chat_id_fr = 0;
if (_messages.length == 0) {
databaseReference
.child("chat")
.child(widget._orderNo)
.child('$rondm_no')
.update({
'vendor_id': vendor_id.toString(),
'user_id': user_id.toString(),
'msg': text.toString(),
'chat_id': 0,
'for_value': 'user',
});
setState(() {
ChatMessage message = new ChatMessage(
text: text.toString(),
vendor: "user",
vendor_name: "",
);
postRequest(text.toString());
print("msg===" + text.toString());
print("msg===" + text.toString());
_messages.insert(0, message);
});
} else {
for (var i = 0; i < _messages.length; i++) {
int chat_id_fr = i + 1;
databaseReference
.child("chat")
.child(widget._orderNo)
.child('$rondm_no')
.update({
'vendor_id': vendor_id.toString(),
'user_id': user_id.toString(),
'msg': text.toString(),
'chat_id': chat_id_fr,
'for_value': 'user',
});
}
setState(() {
ChatMessage message = new ChatMessage(
text: text.toString(),
vendor: "user",
vendor_name: "",
);
postRequest(text.toString());
print("msg===" + text.toString());
print("msg===" + text.toString());
_messages.insert(0, message);
});
}
}
Widget _chatEnvironment() {
return IconTheme(
data: new IconThemeData(color: Color(0xFF7872c0)),
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Row(
children: <Widget>[
new Flexible(
child: new TextField(
decoration: new InputDecoration.collapsed(
hintText: "Starts typing ..."),
controller: _chatController,
onSubmitted: _handleSubmit,
),
),
new Container(
margin: const EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(
icon: new Icon(Icons.send),
onPressed: () => _handleSubmit(_chatController.text),
),
)
],
),
),
);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("المحادثة"), //Conversation
backgroundColor: Color(0xFF7872c0),
),
body: new Column(
children: <Widget>[
new Flexible(
child: ListView.builder(
padding: new EdgeInsets.all(8.0),
reverse: true,
itemBuilder: (_, int index) => _messages[index],
itemCount: _messages.length,
),
),
new Divider(
height: 1.0,
),
new Container(
decoration: new BoxDecoration(
color: Theme.of(context).cardColor,
),
child: _chatEnvironment(),
)
],
));
}
}
供应商聊天屏幕
import 'dart:async';
import 'dart:math';
import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'dart:convert';
import 'dart:async' show Future;
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:koni_app/Pages/UsersPages/MyOrders/Chat.dart';
import 'package:koni_app/Pages/UsersPages/MyOrders/chat_model.dart';
import 'package:koni_app/Pages/UsersPages/MyOrders/chatmessage.dart';
import 'package:http/http.dart' as http;
import 'MyOrders/Vendorchatmessage.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:uuid/uuid.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
import 'MyOrders/vendorchat_model.dart';
class VendorAdminChatPage extends StatefulWidget {
final String _userName;
final String _id;
final String _userid;
final String orderNo;
final String vendorId;
VendorAdminChatPage(this._userName, this._id, this._userid, this.orderNo,this.vendorId);
StreamSubscription _subscriptionTodo;
/*
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF7872c0),
title: Text("تواصل مع الادارة "),
),
body: Center(
child: Text('here the UserAdminChat page it will be '),
),
);
}
*/
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return _VendorChatPageState();
}
}
class _VendorChatPageState extends State<VendorAdminChatPage> {
static var databaseReference = FirebaseDatabase.instance.reference();
var v_id;
var vendor_id;
var user_id;
var user_name, user_token;
final TextEditingController _chatController = new TextEditingController();
final List<Vendorchatmessage> _messages = <Vendorchatmessage>[];
FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
List<VendorChatModel> list_messages = List<VendorChatModel>();
DateTime now = DateTime.now();
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
int chat_id_fr;
Future onSelectNotification(String payload) {
debugPrint("payload : $payload");
showDialog(
context: context,
builder: (_) => new AlertDialog(
title: new Text('Notification'),
content: new Text('$payload'),
),
);
}
@override
void initState() {
vendor_id = widget.vendorId;
user_id = widget._userid;
user_id = widget._userid;
// var user_Id = widget._userid;
print("sssss" + user_id);
getDetails();
getchat();
flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
var android = new AndroidInitializationSettings('@mipmap/ic_launcher');
var iOS = new IOSInitializationSettings();
var initSetttings = new InitializationSettings(android, iOS);
flutterLocalNotificationsPlugin.initialize(initSetttings,
onSelectNotification: onSelectNotification);
_firebaseMessaging.configure(
onLaunch: (Map<String, dynamic> message) {
print('onLaunch called');
showNotification("", "");
},
onResume: (Map<String, dynamic> message) {
print('onResume called');
showNotification("", "");
},
onMessage: (Map<String, dynamic> message) {
print('onMessage called' + message.toString());
Map msg_ = message['notification'];
String body = msg_['body'];
String title = msg_['title'];
setState(() {
showNotification(body, title);
Vendorchatmessage message = new Vendorchatmessage(
text: body.toString(),
vendor: "user",
vendor_name: "",
);
print("msg===" + body.toString());
print("msg===" + body.toString());
_messages.insert(0, message);
});
},
);
_firebaseMessaging.subscribeToTopic('all');
_firebaseMessaging.requestNotificationPermissions(IosNotificationSettings(
sound: true,
badge: true,
alert: true,
));
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
print('Hello');
});
_firebaseMessaging.getToken().then((token) {});
}
showNotification(String body, String title) async {
var android = new AndroidNotificationDetails(
'channel id', 'channel NAME', 'CHANNEL DESCRIPTION',
priority: Priority.High, importance: Importance.Max);
var iOS = new IOSNotificationDetails();
var platform = new NotificationDetails(android, iOS);
await flutterLocalNotificationsPlugin
.show(0, 'New Message', '$body', platform, payload: '$body');
}
Future<String> getDetails() async {
FirebaseDatabase.instance
.reference()
.child("user")
.child(user_id)
.once()
.then((DataSnapshot snapshot) {
Map value = snapshot.value;
var vendor_id_fr = value['id'];
user_name = value['name'];
user_token = value['token'];
//Map<String, dynamic> data = map['Data'];
print("name " + user_name);
print("id " + vendor_id);
print("token " + user_token);
});
return vendor_id.toString();
}
Future<String> getchat() async {
FirebaseDatabase.instance
.reference()
.child("chat")
.child(widget.orderNo)
.once()
.then((DataSnapshot snapshot) {
Map value_ = snapshot.value;
value_.forEach((key, value) {
Map value_1 = value;
chat_id_fr = value_1['chat_id'];
var vendor_msg_fr = value_1['msg'];
var user_id_ = value_['user_id'];
var vendor_id_ = value_['vendor_id'];
VendorChatModel chatModel = new VendorChatModel.fromJson(value);
list_messages.add(chatModel);
list_messages.sort((a, b) => a.chat_id_fr.compareTo(b.chat_id_fr));
});
var list_data = list_messages.toString();
print(list_data.toString());
int dfd = list_messages.length;
for (int i = 0; i <= list_messages.length; i++) {
/* String lower=list_messages.elementAt(0).chat_id_fr;
String lower1=list_messages.elementAt(0).chat_id_fr;
*/
dfd = dfd - 1;
/* int ss=list_messages.length-1;
String ss=ss.toString();*/
if (list_messages.elementAt(dfd).for_value.toString().contains("user")) {
setState(() {
Vendorchatmessage message = new Vendorchatmessage(
text: list_messages.elementAt(dfd).msg,
vendor: "user",
vendor_name: user_name);
_messages.add(message);
});
} else {
setState(() {
Vendorchatmessage message = new Vendorchatmessage(
text: list_messages.elementAt(dfd).msg,
vendor: "vendor",
vendor_name: user_name,
);
_messages.add(message);
});
}
}
});
return vendor_id.toString();
}
void _handleSubmit(String text) {
_chatController.clear();
// Vendorchatmessage message = new Vendorchatmessage(text: text);
String formattedDate = DateFormat('kk:mm:ss').format(now).toString();
var rondm_no;
var uuid = new Uuid();
var rng = new Random();
for (var i = 0; i < 10; i++) {
print(rng.nextInt(100));
rondm_no = uuid.v1().toString() + 'vendor_id';
}
chat_id_fr = 0;
if (_messages.length == 0) {
databaseReference
.child("chat")
.child(widget.orderNo)
.child('$rondm_no')
.update({
'vendor_id': vendor_id.toString(),
'user_id': user_id.toString(),
'msg': text.toString(),
'chat_id': 0,
'for_value': 'vendor',
});
} else {
for (var i = 0; i < _messages.length; i++) {
chat_id_fr = i + 1;
databaseReference
.child("chat")
.child(widget.orderNo)
.child('$rondm_no')
.update({
'vendor_id': vendor_id.toString(),
'user_id': user_id.toString(),
'msg': text.toString(),
'chat_id': chat_id_fr,
'for_value': 'vendor',
});
}
}
/*databaseReference.child("chat").child(widget.orderNo).update({
'vendor_id': vendor_id.toString(),
'user_id': user_id.toString(),
});*/
setState(() {
Vendorchatmessage message = new Vendorchatmessage(
text: text.toString(),
vendor: "vendor",
vendor_name: "",
);
print("msg===" + text.toString());
print("msg===" + text.toString());
_messages.insert(0, message);
postRequest(text.toString());
});
}
Future<http.Response> postRequest(String msg) async {
var url = 'https://fcm.googleapis.com/fcm/send';
Map<String, dynamic> jsonMap1 = {
'notification': {'body': '$msg', 'title': 'New Massage'},
'to': '$user_token',
};
//encode Map to JSON
var body = json.encode(jsonMap1);
var response = await http.post(url,
headers: {
"Content-Type": "application/json",
"Authorization":
"key=AAAAt08dld0:APA91bEY6Dtrb1x1SlAprnEYeSEUdCT0D0oq9qzlkLJDIJdB0-hVIbdKL_L6CysecmOb46gjD3lyZMKl5aGH4rY1daFYA838VMnS7SzumelXie3Vps7s8MkILRgz7Kj0QQ65Dp0uZLI6"
},
body: body);
print("${response.statusCode}" + "=response=");
print("${response.body}" + "=response=");
return response;
}
Widget _chatEnvironment() {
return IconTheme(
data: new IconThemeData(color: Color(0xFF7872c0)),
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Row(
children: <Widget>[
new Flexible(
child: new TextField(
decoration: new InputDecoration.collapsed(
hintText: "Starts typing ..."),
controller: _chatController,
onSubmitted: _handleSubmit,
),
),
new Container(
margin: const EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(
icon: new Icon(Icons.send),
onPressed: () => _handleSubmit(_chatController.text),
),
)
],
),
),
);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("المحادثة"), //Conversation
backgroundColor: Color(0xFF7872c0),
),
body: new Column(
children: <Widget>[
new Flexible(
child: ListView.builder(
padding: new EdgeInsets.all(8.0),
reverse: true,
itemBuilder: (_, int index) => _messages[index],
itemCount: _messages.length,
),
),
new Divider(
height: 1.0,
),
new Container(
decoration: new BoxDecoration(
color: Theme.of(context).cardColor,
),
child: _chatEnvironment(),
)
],
)
/* Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
children: <Widget>[
new Flexible(
child: new ListView.builder(
padding: new EdgeInsets.all(8.0),
reverse: true,
itemBuilder: (_, int index) {},
itemCount: 10,
),
),
new Divider(height: 1.0),
Container(
margin: EdgeInsets.only(bottom: 20.0, right: 10.0, left: 10.0),
child: Row(
children: <Widget>[
new Flexible(
child: new TextField(
decoration: new InputDecoration.collapsed(
hintText: "ارسال الرسالة"), //"Send message"
),
),
new Container(
child: new IconButton(
icon: new Icon(
Icons.send,
color: Color(0xFF7872c0),
),
onPressed: () {
}),
),
],
),
),
],
),
)*/
);
}
}
更新代码
Future<String> getchat() async {
FirebaseDatabase.instance
.reference()
.child("chat")
.child(widget._orderNo)
.onValue
.listen((list_messages) {})
.onData((Event event) {
setState(() {
if (event.snapshot != null) {
Map<dynamic, dynamic> mapOfMaps = Map.from(event.snapshot.value);
list_messages.clear();
mapOfMaps.values.forEach((value) async {
ChatModel vendor = ChatModel.fromJson(Map.from(value));
list_messages.add(vendor);
list_messages.sort((x, y) => x.chat_id_fr.compareTo(y.chat_id_fr));
});
}
});
var list_data = list_messages.toString();
print(list_data.toString());
// list_messages=list_messages.reversed.toList();
int dfd = list_messages.length;
for (int i = 0; i <= list_messages.length; i++) {
dfd = dfd - 1;
/* var value = list_messages.reduce((curr, next) => curr.chat_id_fr > next.chat_id_fr ? curr : next);
var value1 = list_messages.reduce((curr, next) => curr.chat_id_fr > next.chat_id_fr ? curr : next);
*/
if (list_messages
.elementAt(dfd)
.for_value
.toString()
.contains("user")) {
setState(() {
ChatMessage message = new ChatMessage(
text: list_messages.elementAt(dfd).msg,
vendor: "user",
vendor_name: vendor_name);
_messages.add(message);
});
} else {
setState(() {
ChatMessage message = new ChatMessage(
text: list_messages.elementAt(dfd).msg.toString(),
vendor: "vendor",
vendor_name: vendor_name,
);
_messages.add(message);
//list_messages.reversed.toList();
});
}
}
});
return vendor_id.toString();
}
最佳答案
你需要做这个改变
使用 value
而不是 once
使用它从 firebase 获取数据
FirebaseDatabase.instance
.reference()
.child("vendor")
.child(vendor_id)
.onValue
.listen(() {})
.onData((Event event) {
setState(() {
if (event.snapshot != null) {
print("data= " + event.snapshot.value.toString());
Map<dynamic, dynamic> mapOfMaps = Map.from(event.snapshot.value);
arrCategories.clear();
mapOfMaps.values.forEach((value) async {
Category category = Category.fromJson(Map.from(value));
arrCategories.add(category);
});
}
});
});
关于firebase - 如何使用 firebase 的 flutter 进行实时聊天(ios),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57439288/
我想知道 gmail 聊天如何允许用户连接到 AIM,然后像登录到 AIM 一样聊天。 做起来容易吗?怎么做到的? 有人知道任何类似的开源工具吗? 谢谢! 最佳答案 如果你在谈论编程,这里是源代码示例
大家好,我正在尝试制作一个游戏,两个主持人联系起来,他们将“掷硬币”,并确定谁先出局。我决定从基本代码开始。但是我真的没有主意。 Thread server2 = new Thread(new Ser
我已经创建了一个只有 1 个房间的聊天室、私有(private)消息、审核以及一切,现在一切都很好!当我测试聊天时,我意识到在聊天中输入的所有消息都会被保存,如果有很多人使用聊天,它很快就会占用 Fi
当用户键入内容并出现软键盘时,我必须保持聊天回收器 View 的当前项目可见。目前,它覆盖了聊天,我需要回收器 View 项目与键盘一起显示。 我在 list 中尝试了这些: -android:win
我有一个服务器客户端应用程序集。 (家庭作业) 到目前为止,我已经弄清楚如何让多个客户端连接到服务器并让服务器聚合客户端发送的消息,以及如何让服务器将客户端的消息发送回客户端并将其显示在聊天 Pane
如何从我的应用程序发送/接收 Facebook 聊天消息?它是用 .Net、C# 编写的。 最佳答案 如果你可以使用 C,你就可以使用 libpurple (GPL) 和 pidgin-faceboo
我正在使用启用的 Ajax-Wcf 服务开发 Asp.Net 聊天。这是一个非常简单的聊天引擎,其中消息对话框意味着一对一(单个用户),但是我不知道如何管理(以最佳方式)通知新消息可用性。例如,假设有
我的任务是通过服务器构建一个客户端到客户端的聊天程序。客户端 A 将向服务器发送一条消息,然后服务器将消息转发给客户端 B,反之亦然。所有这一切都将同时发生,直到其中一个将其关闭。我有以下程序。 服务
我创建了一个聊天,用户可以在其中输入文本的输入字段。当他输入文本并按下发送(或输入)时,文本位于输入字段上方。像这样: 我想要的:我希望输入字段位于页面底部。我使用 position: absolut
出于个人兴趣,我尝试定义一个模拟 AI,它基于他学到的信息和互联网搜索,以便提供比系统知道的更多的细节。 我举了一个 child 的例子,当他出生时他需要学习一切,他听到了很多然后提出了一些答案。他的
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 3年前关闭。 Improve this qu
我已经开始聊天了,但我已经将用户的 ID 硬编码到 Chat.php 中。 当他们登录站点时,我的登录名将他们的电子邮件设置为 session ( $_SESSION['email']=$email;
当用户点击像 Start a viber chat with us 这样的链接时,我试图找到一种方法来开始 viber 聊天。但到目前为止我没有找到正确的URI来做到这一点。例如,我知道我可以使用 s
我是 Javascript(纯 javascript)新手,我正在尝试创建一个执行以下操作的聊天 Controller 应用程序。 用户输入内容。 有人对我的知识库进行了后调用。 服务器响应消息。 目
已关闭。这个问题是 not about programming or software development 。目前不接受答案。 这个问题似乎不是关于 a specific programming
如果用户在 x 秒/分钟内处于非事件状态,我想结束聊天,以便我们的代理不必等待聊天自行关闭。我还想在结束聊天之前将标签附加到聊天中,以便我可以看到这是由于不活动造成的。 最佳答案 此内容归功于 j
我正在此网站中构建新网站,客户需要 24/7 实时客户支持。我想在网站上集成 Skype 聊天 聊天界面应该在客户端的网站上。 最佳答案 您可以通过在网站上放置 Skype 按钮来使用它。 http:
事实上,我只是开始积极练习 swing,以便我的理论知识能派上用场:) 我已经为聊天 GUI 实现做了很多工作,但最终遇到了一些问题。所以我决定从头开始重新设计聊天 GUI,但我需要为其选择正确的组件
已关闭。这个问题是 not about programming or software development 。目前不接受答案。 这个问题似乎不是关于 a specific programming
我正在尝试进行简单的聊天,其中连接到服务器的用户发送消息,其他用户接收消息。 这是我的 html: function setupEventSource()
我是一名优秀的程序员,十分优秀!