Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
ec7b6648
Commit
ec7b6648
authored
Nov 11, 2011
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inprovement on LongPolling javascript client to change connection status earlier
parent
40dd8cdc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
pushstream.js
misc/js/pushstream.js
+4
-3
No files found.
misc/js/pushstream.js
View file @
ec7b6648
...
@@ -372,6 +372,7 @@
...
@@ -372,6 +372,7 @@
this
.
lastModified
=
null
;
this
.
lastModified
=
null
;
this
.
etag
=
0
;
this
.
etag
=
0
;
this
.
connectionEnabled
=
false
;
this
.
connectionEnabled
=
false
;
this
.
opentimer
=
null
;
this
.
xhrSettings
=
{
this
.
xhrSettings
=
{
url
:
null
,
url
:
null
,
success
:
linker
(
this
.
onmessage
,
this
),
success
:
linker
(
this
.
onmessage
,
this
),
...
@@ -388,6 +389,7 @@
...
@@ -388,6 +389,7 @@
this
.
_closeCurrentConnection
();
this
.
_closeCurrentConnection
();
this
.
connectionEnabled
=
true
;
this
.
connectionEnabled
=
true
;
this
.
_listen
();
this
.
_listen
();
this
.
opentimer
=
setTimeout
(
linker
(
onopenCallback
,
this
),
5000
);
Log4js
.
info
(
"
[LongPolling] connecting to:
"
,
this
.
xhrSettings
.
url
);
Log4js
.
info
(
"
[LongPolling] connecting to:
"
,
this
.
xhrSettings
.
url
);
},
},
...
@@ -408,6 +410,7 @@
...
@@ -408,6 +410,7 @@
},
},
_closeCurrentConnection
:
function
()
{
_closeCurrentConnection
:
function
()
{
this
.
opentimer
=
clearTimer
(
this
.
opentimer
);
if
(
this
.
connection
)
{
if
(
this
.
connection
)
{
try
{
this
.
connection
.
abort
();
}
catch
(
e
)
{
/* ignore error on closing */
}
try
{
this
.
connection
.
abort
();
}
catch
(
e
)
{
/* ignore error on closing */
}
this
.
connection
=
null
;
this
.
connection
=
null
;
...
@@ -435,7 +438,6 @@
...
@@ -435,7 +438,6 @@
if
(
this
.
connectionEnabled
)
{
/* abort(), called by disconnect(), call this callback, but should be ignored */
if
(
this
.
connectionEnabled
)
{
/* abort(), called by disconnect(), call this callback, but should be ignored */
if
(
status
===
304
)
{
if
(
status
===
304
)
{
this
.
_listen
();
this
.
_listen
();
if
(
this
.
pushstream
.
readyState
===
PushStream
.
CONNECTING
)
onopenCallback
.
apply
(
this
);
}
else
{
}
else
{
Log4js
.
info
(
"
[LongPolling] error (disconnected by server):
"
,
status
);
Log4js
.
info
(
"
[LongPolling] error (disconnected by server):
"
,
status
);
this
.
_closeCurrentConnection
();
this
.
_closeCurrentConnection
();
...
@@ -446,7 +448,6 @@
...
@@ -446,7 +448,6 @@
onmessage
:
function
(
responseText
)
{
onmessage
:
function
(
responseText
)
{
Log4js
.
info
(
"
[LongPolling] message received
"
,
responseText
);
Log4js
.
info
(
"
[LongPolling] message received
"
,
responseText
);
if
(
this
.
pushstream
.
readyState
===
PushStream
.
CONNECTING
)
onopenCallback
.
apply
(
this
);
this
.
_listen
();
this
.
_listen
();
var
messages
=
responseText
.
split
(
"
\r\n
"
);
var
messages
=
responseText
.
split
(
"
\r\n
"
);
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
++
)
{
...
@@ -615,7 +616,7 @@
...
@@ -615,7 +616,7 @@
Log4js
.
debug
(
"
message
"
,
data
,
id
,
channel
,
eventid
);
Log4js
.
debug
(
"
message
"
,
data
,
id
,
channel
,
eventid
);
if
(
id
==
-
2
)
{
if
(
id
==
-
2
)
{
if
(
this
.
onchanneldeleted
)
{
this
.
onchanneldeleted
(
channel
);
}
if
(
this
.
onchanneldeleted
)
{
this
.
onchanneldeleted
(
channel
);
}
}
else
if
(
typeof
(
this
.
channels
[
channel
])
!==
"
undefined
"
)
{
}
else
if
(
(
id
>
0
)
&&
(
typeof
(
this
.
channels
[
channel
])
!==
"
undefined
"
)
)
{
if
(
this
.
onmessage
)
{
this
.
onmessage
(
data
,
id
,
channel
,
eventid
);
}
if
(
this
.
onmessage
)
{
this
.
onmessage
(
data
,
id
,
channel
,
eventid
);
}
}
}
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment