opencoweb/coweb — pull request #231 by flosell (2012-12-02 11:42:07+00:00)
Title: Proposed fix for issue #225: Optional argument for prepare to pass application specific data to moderator callbacks

This adds the optional argument 'userDefined' to prepare to pass user-defined data to server implementation:
session.prepare({key: 'someKey', userDefined: {token: 'someToken', otherData: 'other'}})

This userDefined can be used in the server-side moderator implementation, for example to identify the user in canClientJoinSession:

@Override
public synchronized boolean canClientJoinSession(ServerSession client, Message message) {
String token = (String) ((Map) message.getExt().get(
"userDefined")).get("token");
return customTokenVerifcation(token);
}

This might be a somewhat hacky solution but for me, it works.