我们希望每个浏览器有一个套接字,而不是浏览器中每个选项卡一个.我们怎样才能实现它?我读到了有希望的共享网络工作者.对此的参考也值得赞赏.不幸的是,据我所知,mozilla或Internet Explorer尚未实现共享Web工作者.那么在这种情况下该怎么办?我们正在服务器端的node.js上工作.
我不确定如何在服务器端同时使用单个端口用于多个套接字.我们怎么能在node.js中做到这一点.我目前正在使用socket.io并且每个端口有一个套接字.如果解决方案不存在但有可能,那么请提出您的建议,以实现相同的目标.如果我们共享一个端口,那么还有什么问题呢?考虑到客户端可以闲置但会消耗服务器上的端口的情况可能是其他相关选项,因为我们需要为每个客户端维护套接字连接?
我收到RemoteServiceException.如果我只是在活动的onResume()中调用以下内容,就会发生这种情况:
NotificationManager mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notif = new NotificationCompat.Builder(mContext);
notif.setTicker("Notification ticker")
.setContentTitle("Vinceri")
.setContentText("Ha recibido una oferta de trabajo")
.setAutoCancel(true);
//create notification from builder
Notification notification = notif.build();
mNotificationManager.notify(0, mBuilder.buildNotification(content));
Run Code Online (Sandbox Code Playgroud)
仅在调用notify时才会发生.
android.app.RemoteServiceException: Bad notification posted from package com.java: Couldn't create icon: StatusBarIcon(pkg=com.java id=0x1 level=0 visible=true num=0 )
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1264)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4493)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud) node.js ×2
android ×1
html5 ×1
java ×1
javascript ×1
redis ×1
socket.io ×1
sockets ×1
web-worker ×1
websocket ×1