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
f6cf36f7
Commit
f6cf36f7
authored
Apr 17, 2012
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding support to change keys names on template message
parent
e3fca68a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
pushstream.js
misc/js/pushstream.js
+16
-9
No files found.
misc/js/pushstream.js
View file @
f6cf36f7
...
@@ -257,19 +257,19 @@
...
@@ -257,19 +257,19 @@
return
(
text
)
?
window
.
unescape
(
text
)
:
''
;
return
(
text
)
?
window
.
unescape
(
text
)
:
''
;
};
};
var
parseMessage
=
function
(
messageText
)
{
var
parseMessage
=
function
(
messageText
,
keys
)
{
var
msg
=
messageText
;
var
msg
=
messageText
;
if
(
isString
(
messageText
))
{
if
(
isString
(
messageText
))
{
msg
=
parseJSON
(
messageText
);
msg
=
parseJSON
(
messageText
);
}
}
var
message
=
{
var
message
=
{
id
:
msg
.
id
,
id
:
msg
[
keys
.
jsonIdKey
]
,
channel
:
msg
.
channel
,
channel
:
msg
[
keys
.
jsonChannelKey
]
,
data
:
unescapeText
(
msg
.
text
),
data
:
unescapeText
(
msg
[
keys
.
jsonDataKey
]
),
tag
:
msg
.
tag
,
tag
:
msg
[
keys
.
jsonTagKey
]
,
time
:
msg
.
time
,
time
:
msg
[
keys
.
jsonTimeKey
]
,
eventid
:
msg
.
eventid
||
""
eventid
:
msg
[
keys
.
jsonEventIdKey
]
||
""
};
};
return
message
;
return
message
;
...
@@ -338,7 +338,7 @@
...
@@ -338,7 +338,7 @@
/* common callbacks */
/* common callbacks */
var
onmessageCallback
=
function
(
event
)
{
var
onmessageCallback
=
function
(
event
)
{
Log4js
.
info
(
"
[
"
+
this
.
type
+
"
] message received
"
,
arguments
);
Log4js
.
info
(
"
[
"
+
this
.
type
+
"
] message received
"
,
arguments
);
var
message
=
parseMessage
(
event
.
data
);
var
message
=
parseMessage
(
event
.
data
,
this
.
pushstream
);
this
.
pushstream
.
_onmessage
(
message
.
data
,
message
.
id
,
message
.
channel
,
message
.
eventid
);
this
.
pushstream
.
_onmessage
(
message
.
data
,
message
.
id
,
message
.
channel
,
message
.
eventid
);
};
};
...
@@ -672,7 +672,7 @@
...
@@ -672,7 +672,7 @@
var
messages
=
isArray
(
responseText
)
?
responseText
:
responseText
.
split
(
"
\r\n
"
);
var
messages
=
isArray
(
responseText
)
?
responseText
:
responseText
.
split
(
"
\r\n
"
);
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
++
)
{
if
(
messages
[
i
])
{
if
(
messages
[
i
])
{
lastMessage
=
parseMessage
(
messages
[
i
]);
lastMessage
=
parseMessage
(
messages
[
i
]
,
this
.
pushstream
);
this
.
messagesQueue
.
push
(
lastMessage
);
this
.
messagesQueue
.
push
(
lastMessage
);
if
(
!
this
.
pushstream
.
longPollingByHeaders
&&
lastMessage
.
time
)
{
if
(
!
this
.
pushstream
.
longPollingByHeaders
&&
lastMessage
.
time
)
{
this
.
etag
=
lastMessage
.
tag
;
this
.
etag
=
lastMessage
.
tag
;
...
@@ -724,6 +724,13 @@
...
@@ -724,6 +724,13 @@
this
.
urlPrefixLongpolling
=
settings
.
urlPrefixLongpolling
||
'
/lp
'
;
this
.
urlPrefixLongpolling
=
settings
.
urlPrefixLongpolling
||
'
/lp
'
;
this
.
urlPrefixWebsocket
=
settings
.
urlPrefixWebsocket
||
'
/ws
'
;
this
.
urlPrefixWebsocket
=
settings
.
urlPrefixWebsocket
||
'
/ws
'
;
this
.
jsonIdKey
=
settings
.
jsonIdKey
||
'
id
'
;
this
.
jsonChannelKey
=
settings
.
jsonChannelKey
||
'
channel
'
;
this
.
jsonDataKey
=
settings
.
jsonDataKey
||
'
text
'
;
this
.
jsonTagKey
=
settings
.
jsonTagKey
||
'
tag
'
;
this
.
jsonTimeKey
=
settings
.
jsonTimeKey
||
'
time
'
;
this
.
jsonEventIdKey
=
settings
.
jsonEventIdKey
||
'
eventid
'
;
this
.
modes
=
(
settings
.
modes
||
'
eventsource|websocket|stream|longpolling
'
).
split
(
'
|
'
);
this
.
modes
=
(
settings
.
modes
||
'
eventsource|websocket|stream|longpolling
'
).
split
(
'
|
'
);
this
.
wrappers
=
[];
this
.
wrappers
=
[];
this
.
wrapper
=
null
;
this
.
wrapper
=
null
;
...
...
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