type error at createSession
Hello,
thank you for your quick reply last time. I managed to run the module until I tried to create a session. Unfortunatly I cannot figure out any reason for that error in your code.
Thats the error:
/node_modules/etherpad-lite-client/main.js:63
return callback({
^
TypeError: string is not a function
at IncomingMessage.
Please provide more information
From nested calls I get a groupID and a new generated autherID (a.LZZ74fyMq9imQcLs). GroupID exists. The timestamp was put in statically.
etherpad.createAuthor( req.user.username, function(err, author){ etherpad.createSession(groupID, author.authorID, 1414077328212, function(err, data){ // some code console.log(123); }); });
etherpad.createAuthor( req.user.username, function(err, author){
console.log("author", author, "groupID", groupID); // make sure these are defined
etherpad.createSession(groupID, author.authorID, 1414077328212, function(err, data){
// some code
console.log(123);
});
});
yes, both authorID and grouID are defined. I think the problem lays in the way the two functions are nested. I could not find a solution for my problem, but it seems to related to the "closure in a loop"-problem.
oh, it was so simple and not a bug. In contrast to the API the client needs an object containing the parameters: var args = { groupID: the_group.ep_group_id, authorID: author.authorID, validUntil: Date.now()+4_60_60 }; etherpad.createSession(args, function(err, data){ ....
Maybe the error message could be explain issues like that a little bit better.
Please update the read me with a nested example then close the issue ----- Reply message ----- From: "niels seidel" [email protected] To: "tomassedovic/etherpad-lite-client-js" [email protected] Cc: "John McLear" [email protected] Subject: [etherpad-lite-client-js] type error at createSession (#12) Date: Sat, Nov 1, 2014 03:49
oh, it was so simple and not a bug. In contrast to the API the client needs an object containing the parameters: var args = { groupID: the_group.ep_group_id, authorID: author.authorID, validUntil: Date.now()+4_60_60 }; etherpad.createSession(args, function(err, data){ ....
Maybe the error message could be explain issues like that a little bit better.
— Reply to this email directly or view it on GitHubhttps://github.com/tomassedovic/etherpad-lite-client-js/issues/12#issuecomment-61357113.