因此,我希望建立一个允许视频,音频和文本的聊天应用程序.我花了一些时间研究Websockets和WebRTC来决定使用哪个.由于WebRTC有很多视频和音频应用程序,这听起来是一个合理的选择,但还有其他我应该考虑的事情吗?随意分享您的想法.
像:
由于新的WebRTC仅在某些浏览器上可用,而websockets似乎在更多的浏览器中.
可伸缩性 - Websockets使用服务器进行会话,而WebRTC似乎是p2p
多路复用/多个聊天室 - 用于Google+环聊,我仍然可以查看有关如何实施的演示应用
服务器 - Websockets需要RedisSessionStore或RabbitMQ来扩展多台计算机
我正在使用chrome扩展的内置函数截取视口的屏幕截图.在后台脚本中,当收到捕获屏幕截图的消息时,我捕获它并dataURI
使用sendResponse 将其发送回原点.当我console.log
在后台脚本中使用URI时,它非常好,但是当我在原始脚本中收到响应时,结果是未定义的.我究竟做错了什么?
背景脚本:
chrome.runtime.onMessage.addListener(function(request,sender,sendResponse) {
console.log("huf");
if(request.capture) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.captureVisibleTab(null, {}, function(dataUrl) {
if(dataUrl) {
console.log(dataUrl);
sendResponse({"screenshot":dataUrl});
}
});
});
}
return true;
});
Run Code Online (Sandbox Code Playgroud)
内容脚本:
chrome.runtime.sendMessage({"capture":true},function(response) {
console.log(response.screenshot);
});
Run Code Online (Sandbox Code Playgroud) 我想在运行于ubuntu 64bit的kivy应用程序中有一个Web视图。我在网上浏览,浏览了kivy的文档,并在StackOverflow上搜索了答案,但是找不到任何可以完成工作的东西。需要在kivy应用程序中将简单的网页呈现为小部件。请帮帮我。
流浪文件:
config.vm.network "forwarded_port", guest: 8080, host: 8080
Run Code Online (Sandbox Code Playgroud)
在我的虚拟机上,我正在运行以下命令:
python manage.py runserver 0.0.0.0:8080
Run Code Online (Sandbox Code Playgroud)
但是当我尝试curl
在主机上时,响应是curl: (52) Empty reply from server
并且在浏览器上显示127.0.0.1 didn’t send any data.
我在stackoverflow上查看了这个问题,他们中的大多数人都能够通过添加0.0.0.0
到runserver
命令来解决它。但是,我已经添加了它。
我试过:
Disabling the firewall
并通过以下方式允许与虚拟机的所有连接 accepting all input and output in iptables.
我将127.0.0.1 localhost
/etc/hosts 中的更改为0.0.0.0 localhost
但仍然是相同的响应。
我也通过禁用主机上的防火墙来确保我的主机不会阻止它。
注意:我在虚拟机上使用 ubuntu 机器,在主机上使用 mac OS。
我正在尝试测试我的注册网址。当我执行以下操作时,它给了我一个错误。
测试.py
from __future__ import unicode_literals
from django.test import TestCase
# Create your tests here.
class SignUpTest(TestCase):
def test_createAccount(self):
import pdb; pdb.set_trace()
response = self.client.post('/signup/', {'username': 'test_username', 'password': 'test_password',"email":"example@gmail.com", "confirm_password":"test_password", "type_of_user":"1", "first_name":"john", "last_name":"doe"})
print response
self.assertIs(response, {"success":True})
Run Code Online (Sandbox Code Playgroud)
它给了我以下错误:
Internal Server Error: /signup/
Traceback (most recent call last):
File "/Users/akashtomar/.virtualenvs/wingify/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/Users/akashtomar/.virtualenvs/wingify/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/akashtomar/.virtualenvs/wingify/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/akashtomar/.virtualenvs/wingify/lib/python2.7/site-packages/django/views/decorators/csrf.py", line …
Run Code Online (Sandbox Code Playgroud) django ×2
javascript ×1
json ×1
kivy ×1
python ×1
vagrant ×1
virtualbox ×1
webrtc ×1
websocket ×1