javascript xampp client connection - javascript

I try to develop chat application using xampp and jsxc.
when i try to connect with xampp using this http://localhost:5280/http-bind/ url i get this error.
POST http://54.69.166.107:5280/http-bind/
net::ERR_CONNECTION_REFUSEDjsxc.dep.js:4458 sendFunc
I am stuck at this position. This is my function which i written for connection.
$(function() {
jsxc.init({
loginForm: {
form: '#form',
jid: '#username',
pass: '#password'
},
logoutElement: $('#logout'),
rosterAppend: 'body',
root: '/jsxc.example/',
turnCredentialsPath: 'ajax/getturncredentials.json',
loadSettings: function(username, password) {
return {
xmpp: {
url: 'http://localhost:5280/http-bind/',
domain: 'localhost',
resource: 'example',
onlogin: true
}
};
}
});
});
Please suggest me some good ideas for connection. Thanks in advance.

Related

SQL Server connection using tedius and sequelize in NodeJs

Getting below error when trying to connect SQL Server Local database in NodeJs Sequelize.
name: 'SequelizeHostNotFoundError',
message: 'Failed to connect to abcdd\SQL2K12:1433 - getaddrinfo ENOTFOUND abcdd\SQL2K12',
code: 'ESOCKET
Below are my configuration settings and the credentials are correct
"use_env_variable": false,
"username": "username",
"password": "password#123",
"database": "db_test",
"host": "abcdd\\SQL2K12", //actual db hotsname is abcdd\SQL2K12
"dialect": "mssql",
"operatorsAliases": false,
"dialectOptions": {
"encrypt": true,
"trustedConnection": true
}
In SSMS its working fine. And is there issue with port number? As I am not using a port in SSMS.
For me works adding instanceName instead of putting server: 'SERVER\SQLSERVER2K06',
just put "SERVER".
var config = {
server: 'SERVER',
authentication: {
type: 'default',
options: {
userName: 'user',
password: '*****'
}
},
options: {
database: 'NAME',
instanceName: 'SQLSERVER2K06' /*It Works! */
}
}
for tedious:
options.instanceName
The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable.
(no default)
Mutually exclusive with options.port.
check the comments:
https://github.com/tediousjs/node-mssql/issues/130
var config = {
userName: 'test01',
password: 'test01',
server: 'localhost',
options: {
"database":"TestDB",
"instanceName": "SQL2012"
}
};
in your case
var config = { server: 'abcdd', options: {"instanceName": "SQL2K12" } };
Also, make sure TCP enabled on your SQL Server: Sql Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLSERVER > TCP/IP

Changing credentials to a proxy server on the fly

I'm developing an extension for chrome. The extension allows to pick any proxy server from a list, each proxy is required authorization. There is an issue when a user would like to connect to the same proxy server twice but with different credentials for example if a user was successfully logged in the first time the chrome remembers it and when the user would try to connect with other credentials the chrome would use credentials that were inputted in the first login.
var authCredentials = {
username: 'Jack',
password: 'PassForJack'
}
var auth = function () {
return {
authCredentials
};
};
chrome.webRequest.onAuthRequired.addListener(auth, {
urls: ["<all_urls>"]
}, ["blocking"]);
// set a new proxy server for the first login
chrome.proxy.settings.set({
value: {
mode: 'fixed_servers',
rules: {
singleProxy: {
host: 'some-proxy-server.com',
port: 8000
}
}
},
scope: 'regular'
});
// change credentails
authCredentials = {
username: 'Bob',
password: 'PassForBob'
};
// remove proxy configuration
chrome.proxy.settings.set({
value: {
mode: 'direct'
},
scope: 'regular'
});
// remove onAuthListener
chrome.webRequest.onAuthRequired.removeListener(auth)
chrome.webRequest.onAuthRequired.hasListener(auth) // returns false
chrome.webRequest.onAuthRequired.addListener(auth, {
urls: ["<all_urls>"]
}, ["blocking"]);
// lets re connect
chrome.proxy.settings.set({
value: {
mode: 'fixed_servers',
rules: {
singleProxy: {
host: 'some-proxy-server.com',
port: 8000
}
}
},
scope: 'regular'
});
// that doesn't help the user would be logged as "Jack" but has to be as "Bob"
There are multiple possibilities here since the question is not very clear. I would suggest to walk through documentation for the chrome.webRequest first. But My question would be why don't you use interceptor method to check for server-credential pair ? There's a good article about adding interceptor in the background.js script of your extension which suggests to use the beforeRequest hook.

SOCKS5 Proxy Authentication in Google Chrome Extension

I'm trying to create a extension which would use my SOCKS5 proxy with authentication.
Code in my background script is like this:
var config = {
mode: "fixed_servers",
rules: {
fallbackProxy: {
scheme: "socks5",
host: "myhostaddress"
}
}
};
chrome.proxy.settings.set(
{ value: config, scope: 'regular' },
function () { });
chrome.webRequest.onAuthRequired.addListener(
function (details) {
console.log("onAuthRequired!", details);
return ({
authCredentials: {
'username': "uname",
'password': "pass"
}
});
},
{ urls: ["<all_urls>"] },
['blocking']
);
But I always get ERR_SOCKS_CONNECTION_FAILED error on each page...
What am I doing wrong?
As stated in thread, Chrome doesn't support SOCKS5 proxy with authentication. The only browser that might be supported is Maxthon browser.

How Do i connect sails to mongodb?

Im new to sails Js and mongodb. I am absolutely a newbie.
Problem:
I already have a user collection on my mongodb database. I want to connect it to sails to display the list of collection.
Ive seen sails js documentations. I already installed sails-mongo adapter and edited the connection.js....
module.exports = {
// this is my model
attributes: {
firstname: {
type: 'string'
}
},
findUser: function(opts,callback){
///// How am I going to connect to mongo and query the users ?
//// user.find('John Doe') wont work here.
}
}
Run: npm install sails-mongo
in config/connections.js uncomment section related to mongo and enter necessary info there
someMongodbServer: {
adapter: 'sails-mongo',
host: 'mongohost.com',
port: 55915,
user: 'user',
password: 'password',
database: 'dbname'
},
in config/models.js enter you connection adapter variable
...
connection: 'someMongodbServer',
...
done
EDIT:
In order to get the data from database use the following:
User.find({firstname: 'John Doe'}).exec(function(error, user) {
console.log(user);
});

Meteor,Access Google contacts of loggedin user

How to get all contacts of a loggedin user,i added request permission to access google contacts
requestPermissions: {
facebook: ['email', 'user_friends','read_friendlists'],
google:['https://www.google.com/m8/feeds']
},
I don't know how to access contacts,i tried to google it but i'm confused with the results.
Does anyone know how to do this?
can anyone point me to the answer?
I really appreciate any help
I Just used google-contacts atmosphere package and write the following function in server side and it worked for me
var opts= { email: Meteor.user().services.google.email,
consumerKey: "APIKEY",
consumerSecret: "APPSECRET",
token: Meteor.user().services.google.accessToken,
refreshToken: Meteor.user().services.google.refreshToken};
gcontacts = new GoogleContacts(opts);
gcontacts.refreshAccessToken(opts.refreshToken, function (err, accessToken)
{
if(err)
{
console.log ('gcontact.refreshToken, ', err);
return false;
}
else
{
console.log ('gcontact.access token success!');
gcontacts.token = accessToken;
gcontacts.getContacts(function(err, contact)
{
\\here i am able to access all contacts
console.log(contact);
})
}
});
To do this,you need a refreshToken from google,by default meteor will not get it for you.
Add the following code in client side to get the refreshtoken(requestOfflineToken)
Accounts.ui.config({
requestPermissions: {
facebook: ['email', 'user_friends','read_friendlists'],
google:['https://www.google.com/m8/feeds']
},
requestOfflineToken: {
google: true
},
passwordSignupFields: 'USERNAME_AND_EMAIL'
});
NOTE: To work with contacts API you need to enable contacts api in your google console.
Hope it may help someone out there.

Categories

Resources