chat

Sending Pictures like WhatsApp

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 04:36:10
问题 I have made a chatting application. I want to add photo/file sharing concept in my application same as WhatsApp. I have made the app using Xmpp/Openfire and current now I am using this function for photo sharing, but it is not all reliable : public void sendFile(final String path, final String receiver) { Thread thread = new Thread() { public void run() { ServiceDiscoveryManager sdm = ServiceDiscoveryManager .getInstanceFor(connection); if (sdm == null) sdm = new ServiceDiscoveryManager

Send XMPP (Smack) Message

时间秒杀一切 提交于 2019-12-06 03:47:43
Ok, the problem should be trivial but I can't get to the bottom of it. I have two users A & B Their JID's for this example will be A@123 and B@123 where 123 is the IP of the server. I'm sending a message from A->B using the following code: chat = chatmanager.createChat(username, new MessageListener() { public void processMessage(Chat chat, Message message) {}}); String sendUsername = username + "@123"; Message msgObj = new Message(sendUsername, Message.Type.chat); msgObj.setBody(message); chat.sendMessage(msgObj); I've hardcoded the IP so that I'm 100% sure that I attach the "@123" at the end

How to run a background thread in ruby?

南楼画角 提交于 2019-12-06 02:38:22
问题 I am new to ruby and thought it would be a great idea to rebuild a simple chat program I made in C#. I am using Ruby 2.0.0 MRI (Matz’s Ruby Implementation). The problem is I want to have I/O for simple server commands while the server is running. This is the server that was taken from the sample. I added the commands method that uses gets() to get input. I want this method to run as a thread in the background, but the thread is blocking the other thread. require 'socket' # Get sockets from

C# P2P chat application design

天大地大妈咪最大 提交于 2019-12-05 22:48:35
I want to create a simple chat application that doesn't use an explicit server. The main requirement is that the user can simultaneously chat with many friends (just like on Skype etc.). I do not mean a conference chat here, just multiple separate chat-windows. Currently, I want only a LAN messaging application but I'd appreciate, if the design was easy to extend to Internet connections. I wonder what design is appropriate for such an application. What do you think about a solution, where each user app has a TcpListener (the implicit server) and multiple TcpClient objects - one for each friend

智能玩具开发者日志

这一生的挚爱 提交于 2019-12-05 22:33:37
第一天 智能玩具开发者日志 新学的快捷键: Ctrl+ ] 是往里面缩进([外缩) ctrl+shift+]是无序列表(前面点的表示[是数字表示) 1 获取幼教内容: 选取某优质音乐网站 使用requests模块,进入网页,关闭清除缓存的(disable cache) 点all的那个,然后点击某个音乐,在network里的Name里找到以album(专辑)开头的,点击preview查看,点击response获取数据 然后爬取需要的音乐和封面(存到本地不同的文件夹中) 通过 requests.get('https:w4a' )获得music,然后把.content写入音乐文件(用uuid4表示)以及封面图片,然后把音乐名等信息存入MongoDB中 2. content_list 接口 获取内容数据 从数据库获得所有信息 find 改了_id成str,否则不能jsonify,传给前端(jsonify) 前端接口调用数据,进行显示 以下内容都是接口函数, 3. get_cover 获取图片 4. get_music 获取音乐 因为音乐和图片在文件夹中,先os.path.join拼接一下 通过send_file发送到网上,前端去http上请求封面和歌曲 5. reg 注册用户 前端传过来的数据里有 用户注册的信息(用.form.to_dict()接收)

Ios : How to align labels like whatsapp chat message label and time label?

送分小仙女□ 提交于 2019-12-05 18:52:54
In whatsapp, if the message is very short, the text and time are in the same row. If the message is long, the time is in the bottom right corner - the text coming above it. How can i achieve this using Storyboard in Ios Try using something like this to define last line width (Maybe you'll have to tweak text container a bit more for your case): public func lastLineMaxX(message: NSAttributedString, labelWidth: CGFloat) -> CGFloat { // Create instances of NSLayoutManager, NSTextContainer and NSTextStorage let labelSize = CGSize(width: bubbleWidth, height: .infinity) let layoutManager =

- (void)chatDidReceiveMessage:(QBChatMessage *)message not working

≡放荡痞女 提交于 2019-12-05 18:51:55
I have integerated QuickBlox iOS sdk v2.5. I am sending messages to a particular and they are being sent to server but for receiving a message - (void)chatDidReceiveMessage:(QBChatMessage *)message is not getting called This is what I am doing to connect [[QBChat instance] addDelegate:self]; QBUser *chatUser=[QBUser new]; chatUser.ID=[[[NSUserDefaults standardUserDefaults] objectForKey:USERID] integerValue]; chatUser.password=[[NSUserDefaults standardUserDefaults] objectForKey:PASSWORD]; [[QBChat instance] connectWithUser:chatUser completion:nil]; For creating a chatDialog QBChatDialog

Communication between browsers via PHP

限于喜欢 提交于 2019-12-05 18:19:11
I am building a simple ajax chat client for a school project and have thought of a way to implement this, but it seems IMO to be very cumbersome approach: 1) User A sends message which is accepted by a server-side PHP script and saved to database 2) The browser of User B periodically launches a server side PHP script to check if there are any messages in the database for User B. PHP script finds messages from User A and returns them. Is this the right approach? Can communication between these two users be achieved without a database? (This is my first web-application...if I was making this

Is there a way to embed an iframe in an email with text that updates?

a 夏天 提交于 2019-12-05 15:32:30
问题 I want to embed an iframe inside an email that contains the 10 most recent chat messages. Is there a way to make this iframe dynamic so that it always shows the latest 10 chats regardless of when the email is opened? If the iframe is not the correct way to do this, is there a better way? 回答1: You can try to implement an iframe into the email - but your mail will be recognized as spam by many providers. Maybe you should try to render your content dynamically into an image and implement that

wifi chat between two or more android devices

家住魔仙堡 提交于 2019-12-05 13:39:39
I want to develop an chat application to chat between two or more android devices using wifi network.The application should be able to send or receive strings from each other. I have an experience of using Bluetooth network between pc and android. Can any give me any suggestion or right direction. Thanks in advance. You can be able to chat between two android devices in Android Version 4.0 .There is an API called ' Wifi P2P '.More information can be had from here: http://developer.android.com/reference/android/net/wifi/p2p/package-summary.html If you are thinking about connecting devices that