Skip to content

Commit 292949a

Browse files
committed
Allow have custom port and secure mode
1 parent 761bb6f commit 292949a

6 files changed

Lines changed: 29 additions & 19 deletions

File tree

nodejshelper/bootstrap/bootstrap.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public function getSettingVariable($var) {
4141
return $this->settings['public_settings']['path'];
4242
break;
4343

44+
case 'port':
45+
return $this->settings['public_settings']['port'];
46+
break;
47+
48+
case 'secure':
49+
return $this->settings['public_settings']['secure'];
50+
break;
51+
4452
default:
4553
return null;
4654
;

nodejshelper/design/nodejshelpertheme/js/customjs.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
(function() {
22

3+
var socketOptions = {
4+
hostname: lh_inst.nodejsHelperOptions.hostname,
5+
path: lh_inst.nodejsHelperOptions.path
6+
}
7+
8+
if (lh_inst.nodejsHelperOptions.port != '') {
9+
socketOptions.port = parseInt(lh_inst.nodejsHelperOptions.port);
10+
}
11+
12+
if (lh_inst.nodejsHelperOptions.secure == 1) {
13+
socketOptions.secure = true;
14+
}
15+
316
// Initiate the connection to the server
4-
var socket = socketCluster.connect({
5-
hostname: lh_inst.nodejsHelperOptions.hostname,
6-
path: lh_inst.nodejsHelperOptions.path
7-
});
17+
var socket = socketCluster.connect(socketOptions);
818

919
socket.on('error', function (err) {
1020
console.error(err);

nodejshelper/design/nodejshelpertheme/js/nodejshelper.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejshelper/design/nodejshelpertheme/tpl/lhchat/getstatus/lhc_chat_after_cookie_multiinclude.tpl.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
lh_inst.nodejsHelperOptions = {
22
'hostname':'<?php echo erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('hostname')?>',
3-
'path':'<?php echo erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('path')?>'
3+
'path':'<?php echo erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('path')?>',
4+
'port':'<?php echo erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('port')?>',
5+
'secure':'<?php echo erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionNodejshelper')->getSettingVariable('secure')?>',
46
};
7+
58
var thnjs = document.getElementsByTagName('head')[0];
69
var snjs = document.createElement('script');
710
snjs.setAttribute('async',true);

nodejshelper/settings/settings.ini.default.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
'public_settings' => array(
88
'hostname' => '//' . $_SERVER['HTTP_HOST'],
99
'path' => '/socketcluster/',
10+
'port' => null, //some custom port
11+
'secure' => null, // true || false
1012
)
1113
);
1214

nodejshelper/settings/settings.ini.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)