Closed ghost closed 10 years ago
Try joining a channel instead of using connect()
//aps.connect();
aps.sub('main', { joined: function(){ console.log('joined'); } });
Wierd, I'll look into this.
On demo, after RESTORE, from the server is coming IDENT raw
But in my case this is not happening
Which version of the server are you using? Did you update the server side scripts and restarted the server afterward?
Le 2014-06-08 à 13:35, moldcraft notifications@github.com a écrit :
On demo, after RESTORE, from the server is coming IDENT raw
But in my case this is not happening
— Reply to this email directly or view it on GitHub.
@lcharette I use latest version with updated server scripts.
Now I am debugging APE_Server/APScripts/framework/cmd_restore.js
When I add
info.user.pipe.sendRaw('TEST_OK', {test: 'ok'});
it works
But when I try to access somehow info.user.channels
info.user.pipe.sendRaw('TEST_OK', {channels: info.user.channels});
it does nothing
I think it's crashing, gives some fatal error.
In ape.log
nothing appears. Is there any error.log I can look in?
I tried to run aped as root, nothing changes
Hey,
It must be something with some custom server script. Even your initial example works as expected when tested with the server ape.ptejada.com
.
Try unloading any custom scripts from your server.
I have no custom scripts (and I think I will not have in the near future, I use only 'inlinepush' from PHP and I think this is all my application will need)
Here is another debug I did in APE_Server/APScripts/framework/cmd_restore.js
//...
for(var name in info.user.channels){
info.user.pipe.sendRaw('DEBUG1', {i: name});
var channel = info.user.channels[name];
Ape.triggerChannelEvent(channel, "restored", [info.user, channel]);
Ape.triggerChannelEvent(channel, "pleaseWork", [info.user, channel]);
info.user.pipe.sendRaw('DEBUG2', {i: name});
}
//...
So Ape.triggerChannelEvent()
is not working and not showing any errors.
Now I reinstalled everything (all my workspace is inside docker).
uname -a
Linux 3f0d68ad9e33 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.4 LTS
Release: 12.04
Codename: precise
Nothing changes, the bug is still there
Have you tried not using the secure
flag. Also try using the long polling
transport by setting the option transport: 'lp'
and checking the network
requests on DevTools.
It seems the server is not handling the RESTORE command at all.
Can you also provide the console output when you start the server in the foreground. On Jun 9, 2014 5:38 AM, "moldcraft" notifications@github.com wrote:
Now I reinstalled everything (all my workspace is inside docker http://www.docker.com/). Here is APE-Server compilation log http://sourcebox.io/d2b8405d57ede898d34ff21c55edc5d9. APE Server v1.1.3-DEV
Nothing changes
— Reply to this email directly or view it on GitHub https://github.com/ptejada/ApePubSub/issues/24#issuecomment-45475047.
Now I tried secure:false, moved everyting from https to http, transport:lp, nothing changed.
Console output:
[WARN] You have to run 'aped' as root to increase r_limit
_ ___ ___
/_\ | _ \ __|
/ _ \| _/ _|
/_/ \_\_| |___|
AJAX Push Engine
Bind on : 0.0.0.0:6969
Pid : 529
Version : 1.1.3-DEV
Build : Jun 9 2014 09:18:22
Author : Weelya (contact@weelya.com)
[Module] [spidermonkey] Loading module : Javascript embedded (0.01) - Anthony Catel
[spidermonkey] : Loading script ../APScripts/framework/utils.js
[spidermonkey] : Loading script ../APScripts/framework/Request.js
[spidermonkey] : Loading script ../APScripts/framework/cmd_frame.js
[spidermonkey] : Loading script ../APScripts/framework/cmd_eventpush.js
[spidermonkey] : Loading script ../APScripts/framework/cmd_restore.js
[spidermonkey] : Loading script ../APScripts/framework/cmd_event.js
[spidermonkey] : Loading script ../APScripts/framework/cmd_inlinepush.js
[spidermonkey] : Loading script ../APScripts/framework/cmd_propupdate.js
[spidermonkey] : Loading script ../APScripts/framework/cmd_session_set.js
[spidermonkey] : Loading script ../APScripts/framework/hook_join.js
[spidermonkey] : Loading script ../APScripts/framework/hook_connect.js
[spidermonkey] : Loading script ../APScripts/framework/hook_events.js
[spidermonkey] : Loading script ../APScripts/framework/options.js
[spidermonkey] : Loading script ../APScripts/config.js
I found the problem.
I want to make my site on https, and if main https page tries to make request to http urls, the browser does not allow that.
On APE I can't install ssl certificates so I use nginx in the middle.
My nginx config
server {
listen 443;
server_name ~^\d+\.mydomain\.dev$;
location / {
proxy_pass http://127.0.0.1:6969;
}
}
When I changed transport:lp, the request for cmd:RESTORE was pending for some time, then it stoped with 502 bad gateway.
When I connected directly to APE port (without nginx in the middle)
var aps = new APS( window.location.host +':6969', ... );
Everything started to work
Sorry for taking your time because that was my fault. (also sorry for my english)
But here are some questions:
(now I will try to find out maybe my nginx config is too simple and I need to put there some parameters for proxy to work properly)
I made it work by adding this to nginx config
server {
#...
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#...
}
Thanks
If you want to proxy ape on port 80 (or any one), you an also have a look at HaProxy which support websocket. There's a guide on the ape-server main wiki on GitHub.
Envoyé de mon iPhone
Le 2014-06-09 à 10:01, moldcraft notifications@github.com a écrit :
I made it to work by adding this to nginx config
server {
...
proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #...
} and using transport: 'lp' (ws does not work now, but its ok)
— Reply to this email directly or view it on GitHub.
My host also proxies all my applications through and nginx front end server which also provides shared SSL. The websocket does work but not with the secure flag on. My guess is due to the shared SSL certificate.
Do you have a dedicated SSL certificate for your domain?
I generated a wildcard certificate (not bought), and added it to trusted certificates to Chrome.
The first page opens with warning that this certificate is untrusted, but I click "Allow" and on next page refresh it's not bothering me. This happens because my certificate is only for subdomains *.mydomain.dev
, but not for mydomain.dev
. I tried, but without success, to add to certificate SAN mydomain.dev
All subdomains works well and does not give warnings. So I set APE on {number}.mydomain.dev
. For *.ape.mydomain.dev
it doesn't work.
I put here some console.log()s but the execution does not reach them.