client.publish, from server-side, break my bucle

15 views
Skip to first unread message

necro880

unread,
Mar 7, 2012, 3:08:22 PM3/7/12
to Faye users
first, sorry my english its bad.

well, there its my problem.

i try server push, but just server can publish new message. i have a
bucle ( for ), when i call function.

client.publish(channnel, data)

publish my message, but my bucle FOR, finish....

for example i want publish 10 from 100 message, from json.

i write a bucle ( for ), for read all 100 message, when some message
have a particular feature, call the "client.publish()" function. but
my bucle for end when this function its called.

then... always i can send just 1 of 10 message i want send it. because
my for break before end read 100 message from json.

PD: sorry again for my poor english.

James Coglan

unread,
Mar 8, 2012, 7:02:33 PM3/8/12
to faye-...@googlegroups.com
On 7 March 2012 20:08, necro880 <wnsx...@gmail.com> wrote:
i try server push, but just server can publish new message. i have a
bucle ( for ), when i call function.

client.publish(channnel, data)

publish my message, but my bucle FOR, finish....

for example i want publish 10 from 100 message, from json.

i write a bucle ( for ), for read all 100 message, when some message
have a particular feature, call the "client.publish()" function. but
my bucle for end when this function its called.

Don't worry about the English. ("bucle" is "loop" in English by the way.) Here's what you seem to be saying -- can you confirm if this is correct?

You have a loop that publishes messages, but the loop exits early and not all the messages are published. For example:

for (var i = 0, n = messages.length; i < n; i++) {
  client.publish(channel, messages[i]);
}

Is this correct? Or is your problem more complicated than that? Do you have a complete code example that I can run to see the problem?
Reply all
Reply to author
Forward
0 new messages