candy-chat / candy

JavaScript-based multi-user chat client for XMPP.
http://candy-chat.github.io/candy
MIT License
1.32k stars 370 forks source link

problems with configuring in localhost with ejabberd #488

Closed papermate closed 7 years ago

papermate commented 7 years ago

Hi all, I have the awkward feeling of missing something stupid. When I connect to candy I have the usual, FAQ-like grey screen. Here all the infos I can think of

jabber server is ejabberd. http-bind is enabled at localhost:5280/http-bind (when I go to the page I have a ejabberd mod_http_bind messagge). All good. Here the relevante parts of ejabberd.yml

port: 5280
ip: "::"
module: ejabberd_http
web_admin: true
http_poll: true
http_bind: true
register: true
captcha: false
  mod_muc: 
    host: "conference.@HOST@"
    access: muc
    access_create: muc_create
    access_persistent: muc_create
    access_admin: muc_admin     

The room was created with android app (conversations). Name bopq10tnhx4@conference.localhost It works and messages are sent and received.

my /etc/hosts

127.0.0.1       localhost
127.0.1.1       cuoredoro.homenet.telecomitalia.it      cuoredoro
127.0.0.1       conference.localhost
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

content server is nginx. No error, it has been restarted. Here the jabber.conf in sites-enabled


server {
        listen 8009 default_server;
        listen [::]:8009 default_server;

        root /var/www/html/jabber/;
        index index.html;

        server_name default_server;

        location /http-bind/ {
                # you need to change it to your http-bind port
                proxy_pass https://127.0.0.1:5280/http-bind/;
                proxy_buffering off;
                tcp_nodelay on;
                error_page  405 =200 $uri;
        }
}

then, for candy, here is /example/.htaccess


AddDefaultCharset UTF-8
Options +MultiViews
RewriteEngine On
RewriteRule http-bind/ http://localhost:5280/http-bind/ [P]

here the relevant part of index.html. I just added the debug and room name

Candy.init('http-bind/', {
                                core: {
                                        debug: true,
                                        autojoin: ['bopq10tnhx4@conference.localhost']
}}

this is the console output when I connect to 127.0.0.1:8009/example/index.html

GET 
http://127.0.0.1:8009/libs.min.css [HTTP/1.1 404 Not Found 1ms]
GET 
http://127.0.0.1:8009/libs.min.js [HTTP/1.1 404 Not Found 15ms]
GET 
http://127.0.0.1:8009/candy.min.js [HTTP/1.1 404 Not Found 24ms]
Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery.min.js:1:0
GET 
http://127.0.0.1:8009/libs.min.js [HTTP/1.1 404 Not Found 6ms]
GET 
http://127.0.0.1:8009/candy.min.js [HTTP/1.1 404 Not Found 1ms]
ReferenceError: Candy is not defined

Any idea of what it may be? It is probably something silly, but for the life of me I can't figure it out.

Thanks!

benlangfeld commented 7 years ago

From the last log, your web server is not serving the candy source code contained in libs.min.js and Candy.min.js. Are these files present in the defined virtual server root directory?

papermate commented 7 years ago

hello benlangfeld, thanks for your answer. Those files are actually nowhere to be found. I doubled-checked the source tar file, and even there I can't find those libs.min.js and candy.min.js. Where should I look for them?

benlangfeld commented 7 years ago

You have to download the compiled zip release or compile the project yourself.

papermate commented 7 years ago

hello, yes, I just noted that, I download the zip and files were here. Doh, dumb me!