Skip to content

Instantly share code, notes, and snippets.

@photofroggy
photofroggy / example.js
Created August 22, 2012 22:34
At the moment, this is all the javascript you need to run a dAmn client using wsc. At the moment this only works when using the dev branch. The server address needs to be a valid WebSocket address for a server that provides a WebSocket proxy to dAmn.
$(function() {
client = $('.main').wsc( 'init', {
"server": 'ws://proxy.com/dAmn',
"autojoin": '#Botdom',
'username': 'username',
'pk': 'damntoken',
});
client.add_extension(wsc.dAmn.Extension);
app.configure( function() {
app.engine('html', consolidate.mustache);
app.set('view engine', 'html');
app.set('views', path.join(__dirname, 'views'));
chat.configure( app );
app.use('/', express.static(path.join(__dirname, 'static'), { maxAge: 86400000 }));
app.use(express.cookieParser());
info: Welcome to Nodejitsu photofroggy
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing your application dependencies in server.js
info: Creating snapshot 0.0.4
info: Updating app pond
info: Activating snapshot 0.0.4 for pond
info: Starting app pond
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
{
"name": "pond",
"subdomain": "pond",
"scripts": {
"start": "server.js"
},
"version": "0.0.5",
"engines": {
"node": "0.6.x"
},
function proxy( app ) {
var serve = http.createServer();
serve.listen(3900);
wsserve = new wss({
httpServer: serve,
autoAcceptConnections: false
});
info: Welcome to Nodejitsu photofroggy
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing your application dependencies in server.js
info: Creating snapshot 0.0.6
info: Updating app pond
info: Activating snapshot 0.0.6 for pond
info: Starting app pond
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
var io = require('socket.io').listen(server);
info: Welcome to Nodejitsu photofroggy
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing your application dependencies in server.js
warn: Local version appears to be old
warn: Your package.json version will be incremented for you automatically
warn: About to write /Users/Henry/Code/pond/package.json
warn: Using '*' as version for dependencies may eventually cause issues.
warn: Please use specific versions for dependencies to avoid future problems.
data:
var client = ChatClient;
var ui = UIManager;
ui.on('settings.open', function( e, ui ) {
page = e.settings.page('Main');
var orig = {};
orig.theme = replaceAll(client.ui.settings.theme, 'wsct_', '');
orig.clock = client.ui.clock();
page.item('Form', {
'ref': 'myform',
'title': 'Test Form',
'hint': 'This is just an example of a form thingy',
'text': 'Some kind of form here. Just add a few simple\
elements and suchlike. Maybe I could make this\
API make more sense, or just be cleaner. Maybe\
make things more functional or OO.',
'fields': [
['Dropdown', {