Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

クラスタリング時のSocket.IOでコネクションが張られない時がある場合の対処

  • Loading branch information...
commit eb98900a3370852313b191cfdfe0a2e3d3a0a83d 1 parent ea2119b
@nsyee00 nsyee00 authored
View
2  public/js/chatroomApp.js
@@ -48,5 +48,5 @@
if (!connected) {
window.location.reload();
}
- }, 2500);
+ }, 2200);
}).call(this);
View
2  public/js/dist/chatroom.js
@@ -361,5 +361,5 @@
if (!connected) {
window.location.reload();
}
- }, 2500);
+ }, 2200);
}).call(this);
View
2  public/js/dist/chatroom.min.js
@@ -1 +1 @@
-(function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.templates=this.syaberi.templates!=null?this.syaberi.templates:this.syaberi.templates={},e.templates.chat={},e.templates.chat.chatL=Handlebars.compile('<div class="message-owner-inbox" id="chat-content-{{chatId}}"> <div class="owner-icon"> <a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a> </div> <div class="owner-titlebox"> <p class="owner-title">{{{message}}}</p> {{#if extImageUrl}} <img src="{{extImageUrl}}" class="owner-img"> {{/if}} {{#if youtubeVid}} <iframe width="500" height="300" src=" http://www.youtube.com/embed/{{youtubeVid}}" frameborder="0" allowfullscreen></iframe> {{/if}} <div class="owner-username"><a href="/users/{{userId}}">by.{{userName}}</a></div> <div class="owner-date">{{time}} [1] {{#if isHis}} <img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}"> {{/if}} </div> </div> </div>'),e.templates.chat.chatR=Handlebars.compile('<div class="message-member-inbox" id="chat-content-{{chatId}}"> <div class="member-icon"> <a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a> </div> <div class="member-titlebox"> <p class="member-title">{{{message}}}</p> {{#if extImageUrl}} <img src="{{extImageUrl}}" class="member-img"> {{/if}} {{#if youtubeVid}} <iframe width="500" height="300" src=" http://www.youtube.com/embed/{{youtubeVid}}" frameborder="0" allowfullscreen></iframe> {{/if}} <div class="member-username"><a href="/users/{{userId}}">by.{{userName}}</a></div> <div class="member-date">{{time}} [2] {{#if isHis}} <img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}"> {{/if}} </div> {{#if isInvite}}{{#unless isUrlOpen}}{{#if isOwner}} <a href="javascript:void(0);" class="start_chat" data-userid="{{userId}}" data-chatid="{{chatId}}">[招待]</a> {{/if}}{{/unless}}{{/if}} </div> </div>')}).call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.Chat=Backbone.Model.extend({id:null,userId:null,userName:null,type:null,body:null,image:null,time:null,url:"/chats"}),e.Chats=Backbone.Collection.extend({model:e.Chat,url:"/chats"})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=1,n=2,r=3;e.ChatView=Backbone.View.extend({el:$("html"),events:{"click #submit_1":"submit","keydown #message1":"keydown","click img.delete_cmt":"destroy","click a.start_chat":"invite","change #uploadings_input":"upload","change #message1":"uploadOff"},initialize:function(){this.collection=new e.Chats,this.uploadCancelFlg=0,this.token=$("#token").val()},submit:function(n){var r=$.trim($("#message1").val());if(r&&r!==""){var i=$("html").data("chatroom"),s=$("html").data("userid"),o=$("html").data("username"),u=$("html").data("userimage"),a=$("html").data("urlopen");return e.socket.emit("message",{mode:"create",chatroomId:i,userId:s,userName:o,userImage:u,message:r,type:t,isUrlOpen:a,token:this.token}),this.clearInputUserMessage(),!1}},keydown:function(e){if(e.shiftKey!==!0&&e.keyCode===13)return this.submit(e),!1},destroy:function(t){if(window.confirm("本当に削除しますか?")){var n=$(t.target),r=n.data("chatid"),i=$("html").data("chatroom"),s=$("html").data("userid");e.socket.emit("message",{mode:"destroy",chatroomId:i,chatId:r,userId:s,token:this.token})}},invite:function(e){var t=$(e.target),n=t.data("userid"),r=t.data("chatid"),i=$("html").data("chatroom");window.confirm("このユーザとチャットを開始しますか?")&&$.ajax({type:"POST",url:"/chatrooms/"+i+"/invite",data:"member="+n+"&chat="+r,success:function(e){location.href="/chatrooms/"+i+"/open"}})},upload:function(){$("#uploadings_input").upload("/upload",function(e){if(e){var t=e,n=t.split('": "'),r=n[1].split('"}</pre>'),i=$("input#uploadings_input").val().split("\\"),s;for(var o=0;o<i.length;o++)if(i[o].indexOf(".jpg")!=-1||i[o].indexOf(".jpeg")!=-1||i[o].indexOf(".JPG")!=-1||i[o].indexOf(".png")!=-1||i[o].indexOf(".PNG")!=-1||i[o].indexOf(".gif")!=-1||i[o].indexOf(".GIF")!=-1)s=i[o];$("#message1").val(s),this.uploadCancelFlg=1,$("#message1").attr("disabled","disabled"),$("#realUpfile").val(r[0])}},"html")},uploadOff:function(){$("#message1").removeAttr("disabled"),this.uploadCancelFlg===1&&($("input#uploadings_input").val(""),this.uploadCancelFlg=0)},appendMessage:function(t){var n,r=$("html").data("status"),i=$("html").data("urlopen"),s=$("html").data("userid"),o=$("html").data("ownerid"),u={chatId:t.chatId,userImage:t.userImage,userId:t.userId,userName:t.userName,time:t.time,message:t.message,isOwner:s===o,isHis:s===t.userId,isInvite:r!==2,isUrlOpen:i,extImageUrl:"",youtubeVid:""};if(e.util.isUrl(t.message)){var a=e.util.getUrl(t.message);if(e.util.isImageUrl(a))u.extImageUrl=a;else if(e.util.isYoutube(a)){var f=e.util.getYoutubeVid(a);f&&(u.youtubeVid=f)}}o===t.userId?n=e.templates.chat.chatL(u):n=e.templates.chat.chatR(u),$("#lines1").append(n),!i&&t.userId===s&&o!=s&&$("#section_thread_bottom").animate({height:"hide",opacity:"hide"},"slow")},destroyMessage:function(e){var t=e.chatId,n=$("html").data("userid"),r=$("html").data("ownerid");n&&r!=n&&e.userId===n&&$("#section_thread_bottom").animate({height:"show",opacity:"1.0"},"slow"),$("#chat-content-"+t).animate({height:"hide",opacity:"hide"},"slow",function(){$("#chat-content-"+t).remove()})},render:function(){},clearInputUserMessage:function(){$("#message1").val("").focus(),$("#html_image_preview").remove(),$("#user_up_img").remove(),$("#drop_message").show()}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=$("html").data("host"),n=$("html").data("chatroom"),r=$("html").data("urlopen"),i,s=!1;r?i=t+"/chatrooms/"+n+"/open?id="+n+"&urlopen="+r:i=t+"/chatrooms/"+n+"?id="+n,e.socket=io.connect(i,{reconnect:!0,"reconnection delay":300,"max reconnection attempts":10}),e.socket.on("connect",function(){s=!0}),e.socket.on("disconnect",function(e){s=!1}),$(function(){var t=new e.ChatView;t.render(),Backbone.emulateHTTP=!0,e.socket.on("message",function(e){e.mode==="create"?t.appendMessage(e):e.mode==="destroy"&&t.destroyMessage(e)})}),setInterval(function(){s||window.location.reload()},2500)}.call(this);
+(function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.templates=this.syaberi.templates!=null?this.syaberi.templates:this.syaberi.templates={},e.templates.chat={},e.templates.chat.chatL=Handlebars.compile('<div class="message-owner-inbox" id="chat-content-{{chatId}}"> <div class="owner-icon"> <a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a> </div> <div class="owner-titlebox"> <p class="owner-title">{{{message}}}</p> {{#if extImageUrl}} <img src="{{extImageUrl}}" class="owner-img"> {{/if}} {{#if youtubeVid}} <iframe width="500" height="300" src=" http://www.youtube.com/embed/{{youtubeVid}}" frameborder="0" allowfullscreen></iframe> {{/if}} <div class="owner-username"><a href="/users/{{userId}}">by.{{userName}}</a></div> <div class="owner-date">{{time}} [1] {{#if isHis}} <img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}"> {{/if}} </div> </div> </div>'),e.templates.chat.chatR=Handlebars.compile('<div class="message-member-inbox" id="chat-content-{{chatId}}"> <div class="member-icon"> <a href="/users/{{userId}}"><img class="icon_m" src="{{userImage}}"></a> </div> <div class="member-titlebox"> <p class="member-title">{{{message}}}</p> {{#if extImageUrl}} <img src="{{extImageUrl}}" class="member-img"> {{/if}} {{#if youtubeVid}} <iframe width="500" height="300" src=" http://www.youtube.com/embed/{{youtubeVid}}" frameborder="0" allowfullscreen></iframe> {{/if}} <div class="member-username"><a href="/users/{{userId}}">by.{{userName}}</a></div> <div class="member-date">{{time}} [2] {{#if isHis}} <img src="/img/remove.gif" width="12" height="12" alt="閉じる" class="delete_cmt" data-chatid="{{chatId}}"> {{/if}} </div> {{#if isInvite}}{{#unless isUrlOpen}}{{#if isOwner}} <a href="javascript:void(0);" class="start_chat" data-userid="{{userId}}" data-chatid="{{chatId}}">[招待]</a> {{/if}}{{/unless}}{{/if}} </div> </div>')}).call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={};e.Chat=Backbone.Model.extend({id:null,userId:null,userName:null,type:null,body:null,image:null,time:null,url:"/chats"}),e.Chats=Backbone.Collection.extend({model:e.Chat,url:"/chats"})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=1,n=2,r=3;e.ChatView=Backbone.View.extend({el:$("html"),events:{"click #submit_1":"submit","keydown #message1":"keydown","click img.delete_cmt":"destroy","click a.start_chat":"invite","change #uploadings_input":"upload","change #message1":"uploadOff"},initialize:function(){this.collection=new e.Chats,this.uploadCancelFlg=0,this.token=$("#token").val()},submit:function(n){var r=$.trim($("#message1").val());if(r&&r!==""){var i=$("html").data("chatroom"),s=$("html").data("userid"),o=$("html").data("username"),u=$("html").data("userimage"),a=$("html").data("urlopen");return e.socket.emit("message",{mode:"create",chatroomId:i,userId:s,userName:o,userImage:u,message:r,type:t,isUrlOpen:a,token:this.token}),this.clearInputUserMessage(),!1}},keydown:function(e){if(e.shiftKey!==!0&&e.keyCode===13)return this.submit(e),!1},destroy:function(t){if(window.confirm("本当に削除しますか?")){var n=$(t.target),r=n.data("chatid"),i=$("html").data("chatroom"),s=$("html").data("userid");e.socket.emit("message",{mode:"destroy",chatroomId:i,chatId:r,userId:s,token:this.token})}},invite:function(e){var t=$(e.target),n=t.data("userid"),r=t.data("chatid"),i=$("html").data("chatroom");window.confirm("このユーザとチャットを開始しますか?")&&$.ajax({type:"POST",url:"/chatrooms/"+i+"/invite",data:"member="+n+"&chat="+r,success:function(e){location.href="/chatrooms/"+i+"/open"}})},upload:function(){$("#uploadings_input").upload("/upload",function(e){if(e){var t=e,n=t.split('": "'),r=n[1].split('"}</pre>'),i=$("input#uploadings_input").val().split("\\"),s;for(var o=0;o<i.length;o++)if(i[o].indexOf(".jpg")!=-1||i[o].indexOf(".jpeg")!=-1||i[o].indexOf(".JPG")!=-1||i[o].indexOf(".png")!=-1||i[o].indexOf(".PNG")!=-1||i[o].indexOf(".gif")!=-1||i[o].indexOf(".GIF")!=-1)s=i[o];$("#message1").val(s),this.uploadCancelFlg=1,$("#message1").attr("disabled","disabled"),$("#realUpfile").val(r[0])}},"html")},uploadOff:function(){$("#message1").removeAttr("disabled"),this.uploadCancelFlg===1&&($("input#uploadings_input").val(""),this.uploadCancelFlg=0)},appendMessage:function(t){var n,r=$("html").data("status"),i=$("html").data("urlopen"),s=$("html").data("userid"),o=$("html").data("ownerid"),u={chatId:t.chatId,userImage:t.userImage,userId:t.userId,userName:t.userName,time:t.time,message:t.message,isOwner:s===o,isHis:s===t.userId,isInvite:r!==2,isUrlOpen:i,extImageUrl:"",youtubeVid:""};if(e.util.isUrl(t.message)){var a=e.util.getUrl(t.message);if(e.util.isImageUrl(a))u.extImageUrl=a;else if(e.util.isYoutube(a)){var f=e.util.getYoutubeVid(a);f&&(u.youtubeVid=f)}}o===t.userId?n=e.templates.chat.chatL(u):n=e.templates.chat.chatR(u),$("#lines1").append(n),!i&&t.userId===s&&o!=s&&$("#section_thread_bottom").animate({height:"hide",opacity:"hide"},"slow")},destroyMessage:function(e){var t=e.chatId,n=$("html").data("userid"),r=$("html").data("ownerid");n&&r!=n&&e.userId===n&&$("#section_thread_bottom").animate({height:"show",opacity:"1.0"},"slow"),$("#chat-content-"+t).animate({height:"hide",opacity:"hide"},"slow",function(){$("#chat-content-"+t).remove()})},render:function(){},clearInputUserMessage:function(){$("#message1").val("").focus(),$("#html_image_preview").remove(),$("#user_up_img").remove(),$("#drop_message").show()}})}.call(this),function(){var e=this.syaberi!=null?this.syaberi:this.syaberi={},t=$("html").data("host"),n=$("html").data("chatroom"),r=$("html").data("urlopen"),i,s=!1;r?i=t+"/chatrooms/"+n+"/open?id="+n+"&urlopen="+r:i=t+"/chatrooms/"+n+"?id="+n,e.socket=io.connect(i,{reconnect:!0,"reconnection delay":300,"max reconnection attempts":10}),e.socket.on("connect",function(){s=!0}),e.socket.on("disconnect",function(e){s=!1}),$(function(){var t=new e.ChatView;t.render(),Backbone.emulateHTTP=!0,e.socket.on("message",function(e){e.mode==="create"?t.appendMessage(e):e.mode==="destroy"&&t.destroyMessage(e)})}),setInterval(function(){s||window.location.reload()},2200)}.call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.