{"action":"created","issue":{"url":"https://api.github.com/repos/primus/primus/issues/396","labels_url":"https://api.github.com/repos/primus/primus/issues/396/labels{/name}","comments_url":"https://api.github.com/repos/primus/primus/issues/396/comments","events_url":"https://api.github.com/repos/primus/primus/issues/396/events","html_url":"https://github.com/primus/primus/issues/396","id":107282622,"number":396,"title":"Connecting two node apps: createSocket does not work for us","user":{"login":"AleCaste","id":6316907,"avatar_url":"https://avatars.githubusercontent.com/u/6316907?v=3","gravatar_id":"","url":"https://api.github.com/users/AleCaste","html_url":"https://github.com/AleCaste","followers_url":"https://api.github.com/users/AleCaste/followers","following_url":"https://api.github.com/users/AleCaste/following{/other_user}","gists_url":"https://api.github.com/users/AleCaste/gists{/gist_id}","starred_url":"https://api.github.com/users/AleCaste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleCaste/subscriptions","organizations_url":"https://api.github.com/users/AleCaste/orgs","repos_url":"https://api.github.com/users/AleCaste/repos","events_url":"https://api.github.com/users/AleCaste/events{/privacy}","received_events_url":"https://api.github.com/users/AleCaste/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-18T21:35:56Z","updated_at":"2015-09-18T22:50:51Z","closed_at":null,"body":"We have two node applications (let's call them nodeapp1 and nodeapp2).\r\nBoth are running Express.\r\nnodeapp1 is behind an nginx reverse proxy taking care of SSL connections.\r\nnodeapp1 runs the primus server-side library using sockjs as the transformer.\r\n\r\nFrom a browser (we tested this on Chrome) we loaded the primus.js client-side library and tried to connect to nodeapp1:\r\n```\r\n  primus = new Primus('https://nodeapp1domain');\r\n  primus.write('hello');\r\n```\r\nThe above test was successful.\r\n\r\nNow we wanted to do the same (connect to nodeapp1) but not from the browser but from nodeapp2.\r\nTo do so we did the following:\r\n```\r\n  Socket = new Primus.createSocket();\r\n  primus = new Socket('https://nodeapp1domain', {\r\n    transformer: 'sockjs',\r\n    pathname: '/primus',\r\n    parser: 'JSON',\r\n    timeout: 35000\r\n  });\r\n  primus.write('hello');\r\n```\r\nThe above does NOT work!\r\nnodeapp1 does never receive the message from nodeapp2.\r\nAre we doing something wrong?\r\nWhy is it that we can connect from the browser but not from nodeapp2 ?\r\n\r\nNOTE: we can get the specs from nodeapp1 server visiting:\r\n```\r\nhttps://nodeapp1domain/primus/spec\r\n```\r\n... and we get the following:\r\n```\r\n{\"version\":\"3.1.1\",\"pathname\":\"/primus\",\"timeout\":35000,\"parser\":\"json\",\"transformer\":\"sockjs\"}\r\n```"},"comment":{"url":"https://api.github.com/repos/primus/primus/issues/comments/141588176","html_url":"https://github.com/primus/primus/issues/396#issuecomment-141588176","issue_url":"https://api.github.com/repos/primus/primus/issues/396","id":141588176,"user":{"login":"AleCaste","id":6316907,"avatar_url":"https://avatars.githubusercontent.com/u/6316907?v=3","gravatar_id":"","url":"https://api.github.com/users/AleCaste","html_url":"https://github.com/AleCaste","followers_url":"https://api.github.com/users/AleCaste/followers","following_url":"https://api.github.com/users/AleCaste/following{/other_user}","gists_url":"https://api.github.com/users/AleCaste/gists{/gist_id}","starred_url":"https://api.github.com/users/AleCaste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleCaste/subscriptions","organizations_url":"https://api.github.com/users/AleCaste/orgs","repos_url":"https://api.github.com/users/AleCaste/repos","events_url":"https://api.github.com/users/AleCaste/events{/privacy}","received_events_url":"https://api.github.com/users/AleCaste/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T22:50:51Z","updated_at":"2015-09-18T22:50:51Z","body":"**Update:** We tried to perform the test without SSL. We did the following from nodeapp2:\r\n```\r\n  Socket = new Primus.createSocket();\r\n  primus = new Socket('http://nodeapp1domain', {\r\n    transformer: 'sockjs',\r\n    pathname: '/primus',\r\n    parser: 'JSON',\r\n    timeout: 35000\r\n  });\r\n  primus.write('hello');\r\n```\r\n... which did NOT work. But doing the following:\r\n```\r\n  Socket = new Primus.createSocket({\r\n    transformer: 'sockjs',\r\n    pathname: '/primus',\r\n    parser: 'JSON',\r\n    timeout: 35000\r\n  });\r\n  primus = new Socket('http://nodeapp1domain');\r\n  primus.write('hello');\r\n```\r\n... DID work indeed. Any idea why? Aren't the two ways equivalent?\r\nIn any case this works when not using SSL.\r\nIf we use SSL none of the above ways work (but then again, connecting from the browser DOES work).\r\n\r\nPlease help...\r\n"}}