chat

Websocket原理

空扰寡人 提交于 2019-11-30 03:49:00
(本文转自知乎上别人分享的一篇文章,让我这个初学者对于websocket有了形象的理解,特此拿来与大家分享) 一、websocket与http WebSocket是HTML5出的东西(协议),也就是说HTTP协议没有变化,或者说没关系,但HTTP是不支持持久连接的(长连接,循环连接的不算) 首先HTTP有 1.1 和 1.0 之说,也就是所谓的 keep-alive ,把多个HTTP请求合并为一个,但是 Websocket 其实是一个新协议,跟HTTP协议基本没有关系,只是为了兼容现有浏览器的握手规范而已,也就是说它是HTTP协议上的一种补充可以通过这样一张图理解 有交集,但是并不是全部。 另外Html5是指的一系列新的API,或者说新规范,新技术。Http协议本身只有1.0和1.1,而且跟Html本身没有直接关系。。通俗来说,你可以用HTTP协议传输非Html数据,就是这样=。= 再简单来说,层级不一样。 二、Websocket是什么样的协议,具体有什么优点 首先,Websocket是一个持久化的协议,相对于HTTP这种非持久的协议来说。简单的举个例子吧,用目前应用比较广泛的PHP生命周期来解释。 HTTP的生命周期通过 Request 来界定,也就是一个 Request 一个 Response ,那么在 HTTP1.0 中,这次HTTP请求就结束了。 在HTTP1

ASP.NET Chat with WCF

孤街醉人 提交于 2019-11-29 23:23:54
I'm looking to implement a chatroom interface for an ASP.NET page. I'm in the process of learning WCF and it seems that it is appropriate for a chat application. Before I get too involved into WCF I want to be sure it is the right choice to make for developing a chat application in ASP.NET. Can anyone provide any feedback? I found a few example applications that primarily use Silverlight with WCF for chat applications. Are there any limitations if I choose not to use Silverlight? Also, any alternatives to WCF that I would have full control over would be very helpful. I'm aware I can use AJAX

Web Chat Application - ASP.NET/Jabber/Ajax/WCF/Comet/ReverseAjax - Issues Faced - Seeking Insights

主宰稳场 提交于 2019-11-29 21:40:14
问题 I've been trying to build a web based chat application for the past three weeks and i'm facing issues with whatever route (programming technique/technology) i take to build it. I've explained the issues i've experienced with all of'em below. Kindly provide whatever insights you have in this. ASP.NET-AJAX First issue is that it is Not Really Real Time If client hits the chat server every x seconds (constant time stamp) it is not going to be real time unless x is very very less If x is very

How to fully integrate XMPP on a web site with registered users

隐身守侯 提交于 2019-11-29 19:39:39
We have a social networking site where people have contacts and we want it to be integrated with XMPP. We currently use ejabberd XMPP server. Here are my questions: How to properly create account? Right now, what I'm thinking is on user registration on our web app, we'd call a script that would execute an ejabberd command to create a user. User authentication. Upon user login on our website, the user would be automatically logged in on the chat system. How do you do this on the client side with strophe.js? As I understand, you need to provide JID and password for authentication, so I'm

Javascript performance problems with too many dom nodes?

吃可爱长大的小学妹 提交于 2019-11-29 19:13:06
问题 I'm currently debugging a ajax chat that just endlessly fills the page with DOM-elements. If you have a chat going for like 3 hours you will end up with god nows how many thousands of DOM-nodes. What are the problems related to extreme DOM Usage? Is it possible that the UI becomes totally unresponsive (especially in Internet Explorer)? (And related to this question is off course the solution, If there are any other solutions other than manual garbage collection and removal of dom nodes.) 回答1:

Send/sync variable/text over LAN in Python 3 [closed]

孤街醉人 提交于 2019-11-29 18:25:59
OK, I wanted to make an python application that allows me to send a message over LAN. Here's the code that "works" "locally" (imagine that I'm forming 2 of my fingers to make an " on those 2 words) username = input("username: ") run = 1 while run == 1: message = input(username + ": ") if message == "exit": print(username + " left") run = 0 else: print(username + ": " + message) My question how do I send the variable "message" over LAN? I wan't it to send the variable message over LAN to another PC and print it on it and the other way around. Here are several files that may help you with

Socket io chat - disconnecting clients randomly ping timeout and transport close errors ver 2.2.0

社会主义新天地 提交于 2019-11-29 16:20:15
I have a chat app running on Node JS express with Socket io. Previously clients were getting disconnected when they send a large picture over 4 MB, i found out socket io cannot handle/stream/send such large data in Base64 over socket emit events. So I ended up using this socket io file upload module . Now I am using socket io file upload module to let users upload pics/files during their chats. Now even if i upload biggest images/files chat doesn't get disconnect. However, clients are still getting randomly disconnected with many errors like ping timeout, transport close etc even when they are

XMPP chat app got rejected for using VoIP service as background mode

雨燕双飞 提交于 2019-11-29 16:10:10
问题 I Have done a XMPP chat app in which I am using Voip service for getting the Voip key in order to recieve the chat message when I am in background. The functionality all worked fine but the app store is rejecting the app with a response as given below: 2.16: Multitasking apps may only use background services for their intended purposes: VoIP, audio playback, location, task completion, local notifications, etc. 2.16 We found that your app uses a background mode but does not include

Sending a chat message in Facebook using Javascript using the browser console

て烟熏妆下的殇ゞ 提交于 2019-11-29 16:02:00
I'm trying to send a chat message in Facebook using Javascript, but keep getting an error message. Either it being TypeError: Object #<NodeList> has no method 'WHATEVERIPUTHERE' Basically o = the chat text area. The o.WHATEVERIPUTHERE("Hello!") is what I'm trying to do (setting a value for the text area, and sending it) This is what I have tried: var o = document.getElementsByClassName("uiTextareaAutogrow _552m"); o.WHATEVERIPUTHERE("Hello!"); document.getElementsByClassName returns an array of elements. In this case they will have same number with the chat boxes opened. I wrote it in pure

What is the Difference between PrintWriter and DataOutputStream?

徘徊边缘 提交于 2019-11-29 14:25:00
问题 I'm working on a chat room application for android. I read different tutorials; some of them use PrintWriter to send data and some of them use DataOutputStream. What is the difference between these two? Which one is better for a chat app? 回答1: From java docs A DataOutputStream lets an application write primitive Java data types to an output stream in a portable way. An application can then use a data input stream to read the data back in. PrintWriter Prints formatted representations of