Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

message apears twice with faye #22

Closed
danil-z opened this issue Dec 3, 2012 · 2 comments
Closed

message apears twice with faye #22

danil-z opened this issue Dec 3, 2012 · 2 comments

Comments

@danil-z
Copy link

danil-z commented Dec 3, 2012

Hello everyone
i have a strange behavour - when i send a message it apears twice on page (but in database it's writen only once as normal). seems JS script with eval(data) runs twice. Why this might happen?

i've changed init.js.cofee to make sure

$ ->
  fayeUrl = window.location.protocol + "//" + window.location.hostname + ":9292/faye" # change port for post of your Faye daemon
  fayeJS = fayeUrl + ".js"
  $.getScript(fayeJS, (e)->
    faye = new Faye.Client(fayeUrl)
    faye.subscribe(window.location.pathname, (data)->
      console.log(data)
    )
  )

and in console i see:

$("#messages_box").append("<div class=\'message\'>\n  <p>\n    <span>\n      danil@gmail.com\n      @\n      Пн, 03 дек. 2012, 05:08:28 +0000\n      :\n    <\/span>\n    <b>666<\/b>\n  <\/p>\n<\/div>\n");
    $("#new_message")[0].reset();
 init.js:11
    $("#messages_box").append("<div class=\'message\'>\n  <p>\n    <span>\n      danil@gmail.com\n      @\n      Пн, 03 дек. 2012, 05:08:28 +0000\n      :\n    <\/span>\n    <b>666<\/b>\n  <\/p>\n<\/div>\n");
    $("#new_message")[0].reset();

my faye.ru has content:

require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
Faye::WebSocket.load_adapter('thin')
run faye_server

Could you give me some idea why this does happen?

@kirs
Copy link
Contributor

kirs commented Mar 12, 2013

This could happen because the gem was tested only with Faye 0.7 which was released more than 1 year ago and now you have a newer version.

Or another guess, you have 2 init.js.coffee files: one from the gem, another from your app.

And I'm really sorry for answering so long :(

@dkoropenko
Copy link
Contributor

Hello.
Sorry, but this project is archived.
Works by project no longer conducted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants