Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
ofbiz-comet-messenger
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f18a1068
authored
2015-04-27 13:12:22 -0500
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
#5084 Set comet timeout.
1 parent
b8a609a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
src/com/brainfood/ofbiz/CometMessengerServlet.java
webapp/scripts/messenger.js
src/com/brainfood/ofbiz/CometMessengerServlet.java
View file @
f18a106
...
...
@@ -79,6 +79,7 @@ public class CometMessengerServlet extends HttpServlet implements CometProcessor
response
.
setHeader
(
"X-Accel-Buffering"
,
"No"
);
if
(
event
.
getEventType
()
==
CometEvent
.
EventType
.
BEGIN
)
{
Debug
.
logInfo
(
"Begin for session: "
+
request
.
getSession
(
true
).
getId
(),
module
);
event
.
getHttpServletRequest
().
setAttribute
(
"org.apache.tomcat.comet.timeout"
,
new
Integer
(
0xFFFFFFFF
));
PrintWriter
writer
=
response
.
getWriter
();
writer
.
println
(
"{\"channel\":\"system\", \"message\":\"CONNECT\"}"
);
writer
.
flush
();
...
...
webapp/scripts/messenger.js
View file @
f18a106
...
...
@@ -10,9 +10,6 @@ define([], function() {
request
.
onreadystatechange
=
function
()
{
if
(
request
.
readyState
==
3
||
request
.
readyState
==
4
)
{
if
(
request
.
status
==
200
){
if
(
request
.
onreadystatechange
)
{
request
.
onreadystatechange
=
null
;
}
if
(
request
.
responseText
)
{
var
newText
=
request
.
responseText
.
substr
(
responseLength
);
if
(
newText
.
length
>
0
)
{
...
...
@@ -24,8 +21,10 @@ define([], function() {
}
}
if
(
request
.
readyState
==
4
)
{
// Request is complete. Remove existing callback.
request
.
onreadystatechange
=
null
;
if
(
request
.
status
==
200
)
{
messenger
.
process
(
);
setTimeout
(
function
()
{
messenger
.
process
();
},
500
);
}
else
{
console
.
log
(
'Error, retrying in 5 seconds'
);
setTimeout
(
function
()
{
messenger
.
process
();
},
5000
);
...
...
Please
register
or
sign in
to post a comment