From 6ea02c11d33143c637cf7e56a2cfc602b7dfd174 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 30 Jul 2012 23:00:33 -0500 Subject: [PATCH 01/38] * initial build ready (i think) --- .gitignore | 5 +++++ .rvmrc | 1 + Gemfile | 3 +++ Gemfile.lock | 10 ++++++++++ README.md | 15 +++++++++++++++ build | 20 ++++++++++++++++++++ build_protoc | 23 +++++++++++++++++++++++ build_rprotoc | 21 +++++++++++++++++++++ src/login.pb | 4 ++++ 9 files changed, 102 insertions(+) create mode 100644 .gitignore create mode 100644 .rvmrc create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100755 build create mode 100755 build_protoc create mode 100755 build_rprotoc create mode 100644 src/login.pb diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..1caad971e --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +target +*.swp +*~ +bin +.bundle diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 000000000..5091144de --- /dev/null +++ b/.rvmrc @@ -0,0 +1 @@ +rvm use ruby-1.9.3@jam-pb --create diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..e13e6cff1 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'ruby_protobuf', '0.4.11' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..59d0d0823 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,10 @@ +GEM + remote: https://rubygems.org/ + specs: + ruby_protobuf (0.4.11) + +PLATFORMS + ruby + +DEPENDENCIES + ruby_protobuf (= 0.4.11) diff --git a/README.md b/README.md new file mode 100644 index 000000000..612bb5adc --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +Jam-Pb (Protocol Buffers) +========================= + +Environment +----------- + +Download and install protoc 2.4.1 on the command-line: +http://code.google.com/p/protobuf/downloads/list + +Bash + +Building +-------- + +./build diff --git a/build b/build new file mode 100755 index 000000000..4021fc891 --- /dev/null +++ b/build @@ -0,0 +1,20 @@ +#!/bin/bash + +TARGET=target +SRC=src + +# clean +rm -rf $TARGET +# prep output +mkdir $TARGET + +# find all protocol buffer files in src directory +PROTO_FILES=`find src -name *.pb` + +# make variables available to sub-scripts +export SRC TARGET PROTO_FILES + +# cpp/java/python supported by protoc +./build_protoc +# ruby supported by rprotoc +./build_rprotoc diff --git a/build_protoc b/build_protoc new file mode 100755 index 000000000..b712a8115 --- /dev/null +++ b/build_protoc @@ -0,0 +1,23 @@ +#!/bin/bash + +# this build file uses protoc to build all protocol buffers +# http://code.google.com/p/protobuf/downloads/list + +TARGET_CPP="$TARGET/cpp" + +mkdir -p "$TARGET_CPP" + +PROTOC_ARGS="--cpp_out=$TARGET/cpp" + +# if you don't want to put protoc on the command line, +# then set a PROTOC environment variable +if [ -z $PROTOC] ; then + PROTOC="protoc" +fi + +command -v $PROTOC >/dev/null 2>&1 || { echo >&2 "protoc is required but not installed. Aborting."; exit 1; } + +# die on error at this point +set -e + +$PROTOC $PROTO_FILES --cpp_out=$TARGET/cpp --proto_path=$SRC diff --git a/build_rprotoc b/build_rprotoc new file mode 100755 index 000000000..ba33fb02a --- /dev/null +++ b/build_rprotoc @@ -0,0 +1,21 @@ +#!/bin/bash + +# ruby protocol buffers +# http://code.google.com/p/ruby-protobuf/ +RUBY_OUT=$TARGET/ruby + +# we exit with 0; treat ruby as optional at the moment +command -v "bundle" >/dev/null 2>&1 || { echo >&2 "bundle is required but not installed. Skipping ruby protocol buffers."; exit 0; } + +# creates a bin folder with 'rprotoc' command inside +bundle install --binstubs + +# die on error at this point +set -e + +for i in "${PROTO_FILES[@]}" +do + bin/rprotoc --proto_path $SRC --out $RUBY_OUT "$i" +done + + diff --git a/src/login.pb b/src/login.pb new file mode 100644 index 000000000..944f67584 --- /dev/null +++ b/src/login.pb @@ -0,0 +1,4 @@ +message Login { + required string session_id = 1; + required string username = 2; +} From 521ae8f3e3d7ed8e4673bc94109fdd573ff82cae Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 30 Jul 2012 23:03:41 -0500 Subject: [PATCH 02/38] * beefing up readme --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 612bb5adc..c4f049066 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,18 @@ Jam-Pb (Protocol Buffers) Environment ----------- -Download and install protoc 2.4.1 on the command-line: -http://code.google.com/p/protobuf/downloads/list - -Bash +* Download and install protoc 2.4.1 on the command-line: [Protocol Buffers Download](http://code.google.com/p/protobuf/downloads/list) +* Bash +* Optionally, if you have 'bundle' available (ruby dependency management tool), protocol buffers for ruby will also build. Building -------- ./build + +Using +----- +./target/cpp has cpp output +./target/ruby has ruby output + +... this is a bit raw... could some day be better. But for now... From 47322c2be5a10d44cb3fde52493ef72e85ad370b Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 1 Aug 2012 23:13:17 -0500 Subject: [PATCH 03/38] * changing file extension to match normal protobuffer extension; added optional protoc_c build --- build | 4 +++- build_protoc-c | 22 ++++++++++++++++++++++ src/{login.pb => login.proto} | 0 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 build_protoc-c rename src/{login.pb => login.proto} (100%) diff --git a/build b/build index 4021fc891..fc921a903 100755 --- a/build +++ b/build @@ -9,7 +9,7 @@ rm -rf $TARGET mkdir $TARGET # find all protocol buffer files in src directory -PROTO_FILES=`find src -name *.pb` +PROTO_FILES=`find src -name *.proto` # make variables available to sub-scripts export SRC TARGET PROTO_FILES @@ -18,3 +18,5 @@ export SRC TARGET PROTO_FILES ./build_protoc # ruby supported by rprotoc ./build_rprotoc +# c supported by protoc-c +./build_protoc-c diff --git a/build_protoc-c b/build_protoc-c new file mode 100755 index 000000000..f3618ca8f --- /dev/null +++ b/build_protoc-c @@ -0,0 +1,22 @@ +#!/bin/bash + +# this build file uses protoc to build all protocol buffers +# http://code.google.com/p/protobuf/downloads/list + +TARGET_C="$TARGET/c" + +mkdir -p "$TARGET_C" + +# if you don't want to put protoc on the command line, +# then set a PROTOC environment variable +if [ -z $PROTOCC] ; then + PROTOCC="protoc-c" +fi + +# running protoc-c is currently optional +command -v $PROTOCC >/dev/null 2>&1 || { echo >&2 "protoc-c is required but not installed. Aborting."; exit 0; } + +# die on error at this point +set -e + +$PROTOCC $PROTO_FILES --c_out=$TARGET_C --proto_path=$SRC diff --git a/src/login.pb b/src/login.proto similarity index 100% rename from src/login.pb rename to src/login.proto From 00dd36a8f75ae5b6cba0ad42a49f209750d87951 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 5 Aug 2012 23:01:24 -0500 Subject: [PATCH 04/38] * trying out container type --- Gemfile | 2 +- Gemfile.lock | 4 ++-- build | 2 ++ build_protoc | 5 ++--- build_protoc-c | 1 + build_rprotoc | 8 +++----- src/login.proto | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index e13e6cff1..1198e742f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'ruby_protobuf', '0.4.11' +gem 'ruby-protocol-buffers' diff --git a/Gemfile.lock b/Gemfile.lock index 59d0d0823..c368bdb9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,10 @@ GEM remote: https://rubygems.org/ specs: - ruby_protobuf (0.4.11) + ruby-protocol-buffers (1.2.2) PLATFORMS ruby DEPENDENCIES - ruby_protobuf (= 0.4.11) + ruby-protocol-buffers diff --git a/build b/build index fc921a903..166df99f9 100755 --- a/build +++ b/build @@ -14,6 +14,8 @@ PROTO_FILES=`find src -name *.proto` # make variables available to sub-scripts export SRC TARGET PROTO_FILES +set -e + # cpp/java/python supported by protoc ./build_protoc # ruby supported by rprotoc diff --git a/build_protoc b/build_protoc index b712a8115..452a2dc25 100755 --- a/build_protoc +++ b/build_protoc @@ -7,8 +7,6 @@ TARGET_CPP="$TARGET/cpp" mkdir -p "$TARGET_CPP" -PROTOC_ARGS="--cpp_out=$TARGET/cpp" - # if you don't want to put protoc on the command line, # then set a PROTOC environment variable if [ -z $PROTOC] ; then @@ -20,4 +18,5 @@ command -v $PROTOC >/dev/null 2>&1 || { echo >&2 "protoc is required but not ins # die on error at this point set -e -$PROTOC $PROTO_FILES --cpp_out=$TARGET/cpp --proto_path=$SRC +echo "building cpp protocol buffers" +$PROTOC $PROTO_FILES --cpp_out=$TARGET_CPP --proto_path=$SRC diff --git a/build_protoc-c b/build_protoc-c index f3618ca8f..ab88764fe 100755 --- a/build_protoc-c +++ b/build_protoc-c @@ -19,4 +19,5 @@ command -v $PROTOCC >/dev/null 2>&1 || { echo >&2 "protoc-c is required but not # die on error at this point set -e +echo "building c protocol buffers" $PROTOCC $PROTO_FILES --c_out=$TARGET_C --proto_path=$SRC diff --git a/build_rprotoc b/build_rprotoc index ba33fb02a..cdc6c853e 100755 --- a/build_rprotoc +++ b/build_rprotoc @@ -8,14 +8,12 @@ RUBY_OUT=$TARGET/ruby command -v "bundle" >/dev/null 2>&1 || { echo >&2 "bundle is required but not installed. Skipping ruby protocol buffers."; exit 0; } # creates a bin folder with 'rprotoc' command inside -bundle install --binstubs +bundle install --binstubs > /dev/null # die on error at this point set -e -for i in "${PROTO_FILES[@]}" -do - bin/rprotoc --proto_path $SRC --out $RUBY_OUT "$i" -done +echo "building ruby protocol buffers" +bin/ruby-protoc $PROTO_FILES --proto_path $SRC --ruby_out $RUBY_OUT diff --git a/src/login.proto b/src/login.proto index 944f67584..4f960f2ca 100644 --- a/src/login.proto +++ b/src/login.proto @@ -1,4 +1,4 @@ message Login { - required string session_id = 1; - required string username = 2; + optional string username = 1; // username + optional string token = 2; // a token provided by the server that validates this user } From 316c225cac74ea81d126c3f2fb7bab1a376030ec Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 5 Aug 2012 23:59:22 -0500 Subject: [PATCH 05/38] * adding package_java to build java files. collasping all client messages into client_container.java --- build | 3 ++- build_protoc | 5 +++++ ivy.xml | 10 ++++++++++ ivysettings.xml | 8 ++++++++ package_java | 16 ++++++++++++++++ src/client_container.proto | 24 ++++++++++++++++++++++++ src/login.proto | 4 ---- 7 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 ivy.xml create mode 100644 ivysettings.xml create mode 100755 package_java create mode 100644 src/client_container.proto delete mode 100644 src/login.proto diff --git a/build b/build index 166df99f9..47f91d514 100755 --- a/build +++ b/build @@ -9,7 +9,8 @@ rm -rf $TARGET mkdir $TARGET # find all protocol buffer files in src directory -PROTO_FILES=`find src -name *.proto` +#PROTO_FILES=`find src -name *.proto` +PROTO_FILES=src/client_container.proto # make variables available to sub-scripts export SRC TARGET PROTO_FILES diff --git a/build_protoc b/build_protoc index 452a2dc25..47c2a6fd2 100755 --- a/build_protoc +++ b/build_protoc @@ -3,9 +3,12 @@ # this build file uses protoc to build all protocol buffers # http://code.google.com/p/protobuf/downloads/list + TARGET_CPP="$TARGET/cpp" +TARGET_JAVA="$TARGET/java" mkdir -p "$TARGET_CPP" +mkdir -p "$TARGET_JAVA" # if you don't want to put protoc on the command line, # then set a PROTOC environment variable @@ -20,3 +23,5 @@ set -e echo "building cpp protocol buffers" $PROTOC $PROTO_FILES --cpp_out=$TARGET_CPP --proto_path=$SRC +echo "building java protocol buffers" +$PROTOC $PROTO_FILES --java_out=$TARGET_JAVA --proto_path=$SRC diff --git a/ivy.xml b/ivy.xml new file mode 100644 index 000000000..3e6df90b2 --- /dev/null +++ b/ivy.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ivysettings.xml b/ivysettings.xml new file mode 100644 index 000000000..ba74af988 --- /dev/null +++ b/ivysettings.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/package_java b/package_java new file mode 100755 index 000000000..83bb0e8da --- /dev/null +++ b/package_java @@ -0,0 +1,16 @@ +#!/bin/bash + +# not yet integrated into any formal build step. +# usage: after you've run ./build, run ./package_java to generate a jar +set -e + +echo "packaging java" +# retrieve protocol buffer dependency +java -jar $IVY -sync -retrieve "target/lib/[conf]/[artifact]-[type].[ext]" +# compile java file generated by protocol buffrs +javac -cp target/lib/default/protobuf-java-jar.jar target/java/jampb/ClientContainer.java +pushd target/java/jampb +# create jar with all classes generated by javac +jar cvf jampb-clientcontainer.jar `find . -name \*.class` +popd + diff --git a/src/client_container.proto b/src/client_container.proto new file mode 100644 index 000000000..7a721325d --- /dev/null +++ b/src/client_container.proto @@ -0,0 +1,24 @@ + +package jampb; + +message ClientMessage { + enum Type { LOGIN = 1; JOIN_JAM_SESSION = 2;} + + // Identifies which inner message is filled in + required Type type = 1; + required string target = 2; + + // One of the following messages can be populated + optional Login login = 100; + optional JoinJamSession join_jam_session = 101; +} + +message JoinJamSession { + optional string user_token = 1; // token provided from previous login + optional string jam_session_id = 2; // id for jam_session +} + +message Login { + optional string username = 1; // username + optional string token = 2; // a token provided by the server that validates this user +} diff --git a/src/login.proto b/src/login.proto deleted file mode 100644 index 4f960f2ca..000000000 --- a/src/login.proto +++ /dev/null @@ -1,4 +0,0 @@ -message Login { - optional string username = 1; // username - optional string token = 2; // a token provided by the server that validates this user -} From 6c580d9ff9bff7fd4979fe3415d71ebc0bfeb562 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 18 Aug 2012 13:56:16 -0500 Subject: [PATCH 06/38] * adding latest 'style' of messages --- Gemfile | 2 +- Gemfile.lock | 2 +- build_rprotoc | 1 + package_ruby | 51 +++++++++++++++++++ src/client_container.proto | 101 +++++++++++++++++++++++++++++++++---- 5 files changed, 145 insertions(+), 12 deletions(-) create mode 100755 package_ruby diff --git a/Gemfile b/Gemfile index 1198e742f..c5ba9b467 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'ruby-protocol-buffers' +gem 'ruby-protocol-buffers', '1.2.2' diff --git a/Gemfile.lock b/Gemfile.lock index c368bdb9d..5151acc4d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,4 +7,4 @@ PLATFORMS ruby DEPENDENCIES - ruby-protocol-buffers + ruby-protocol-buffers (= 1.2.2) diff --git a/build_rprotoc b/build_rprotoc index cdc6c853e..e019cc519 100755 --- a/build_rprotoc +++ b/build_rprotoc @@ -16,4 +16,5 @@ set -e echo "building ruby protocol buffers" bin/ruby-protoc $PROTO_FILES --proto_path $SRC --ruby_out $RUBY_OUT +./package_ruby diff --git a/package_ruby b/package_ruby new file mode 100755 index 000000000..5e39d1064 --- /dev/null +++ b/package_ruby @@ -0,0 +1,51 @@ +#!/bin/bash + +echo "packaging ruby protocol buffers" +pushd target/ruby > /dev/null + +rm -rf jampb + +bundle gem jampb > /dev/null + +# copy over built ruby code +cp src/*.rb jampb/lib/jampb + +pushd jampb > /dev/null + +# define gemspec +cat >> jampb.gemspec << EOF + +# -*- encoding: utf-8 -*- +require File.expand_path('../lib/jampb/version', __FILE__) + +Gem::Specification.new do |gem| + gem.authors = ["Seth Call"] + gem.email = ["seth@jamkazam.com"] + gem.description = %q{protocol buffers for jamkazam} + gem.summary = %q{protocol buffers for jamkazam.} + gem.homepage = "http://www.jamkazam.com" + + gem.files = ['Gemfile', 'Rakefile', 'README.md', 'jampb.gemspec', 'lib/jampb.rb', 'lib/jampb/client_container.pb.rb', 'lib/jampb/version.rb' ] + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.name = "jampb" + gem.require_paths = ["lib"] + gem.version = Jampb::VERSION +end +EOF + +# make sure library manifest includes the generated ruby file +cat >> lib/jampb.rb << EOF +require "jampb/version" +require "jampb/client_container.pb" + +module Jampb +end + +EOF + +gem build jampb.gemspec > /dev/null + +popd > /dev/null +popd > /dev/null + diff --git a/src/client_container.proto b/src/client_container.proto index 7a721325d..e4a3e0375 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -1,24 +1,105 @@ +// adding a new message: +// within ClientMessage block, +// create a new field in the enum Type section (100s are meant to be normal messages; 1000s are meant to be errors). It will have new field number X +// create a optional message of the same name, and use the same field number X. +// then at bottom of the file (or wherever; just outside any existing blocks), add your message definition. + package jampb; message ClientMessage { - enum Type { LOGIN = 1; JOIN_JAM_SESSION = 2;} + enum Type { + LOGIN = 100; + LOGIN_ACK = 101; + LOGIN_JAM_SESSION = 102; + LOGIN_JAM_SESSION_ACK = 103; + USER_JOINED_JAM_SESSION = 104; + LEAVE_JAM_SESSION = 105; + LEAVE_JAM_SESSION_ACK = 106; + + SERVER_GENERIC_ERROR = 1000; + } // Identifies which inner message is filled in required Type type = 1; required string target = 2; // One of the following messages can be populated - optional Login login = 100; - optional JoinJamSession join_jam_session = 101; -} - -message JoinJamSession { - optional string user_token = 1; // token provided from previous login - optional string jam_session_id = 2; // id for jam_session + // Client-Server messages (to/from) + optional Login login = 100; // to server + optional LoginAck login_ack = 101; // from server + optional LoginJamSession login_jam_session = 102; // to server + optional LoginJamSessionAck login_jam_session_ack = 103; // from server + optional UserJoinedJamSession user_joined_jam_session = 104; // from server to all members + optional LeaveJamSession leave_jam_session = 105; + optional LeaveJamSessionAck leave_jam_session_ack = 106; + + // Client-Session messages (to/from) + + + // Server-to-Client errors + optional ServerGenericError server_generic_error = 1000; } +// target: server +// sent from client to server to associate the connection with a user +// either supply a username/password, or just supply token +// if successful, a LoginAck is sent. +// if errored, a GenericServerError is sent and the connection is closed. message Login { - optional string username = 1; // username - optional string token = 2; // a token provided by the server that validates this user + optional string username = 1; // username... could be email. need to wait for prod requirements + optional string password = 2; // a password + optional string token = 3; // a token/cookie from previous successful login attempt or from 'token' field in .jam file +} + +// target: client +// sent from server to client to let the client know the login was successful, +// and to also show the IP address of the client as seen by the server. +message LoginAck { + optional string public_ip = 1; +} + +// target: server +// send from client to server to log in to a jam session and be 'present'. +// if successful, a LoginJamSessionAck is sent with error = false, and Client-Session messages will be passed +// directly from client to all other client. Also, the server will generate a 'UserJoinedJamSession' message +// and send it to all other users to let the others know the user is here. +// if errored, a LoginJamSessionAck is sent with error = true. +message LoginJamSession { + optional string jam_session = 1; +} + +// target: client +// error = true if the LoginJamSession command failed. +message LoginJamSessionAck { + optional bool error = 1; + optional string error_reason = 2; +} + +// target: server +// send from client to server to leave a previously joined jam session +message LeaveJamSession { + optional string jam_session = 1; +} + +// target: client +// error = true if the session didn't exist, but otherwise this is intended to always work barring server unrecoverable errors +message LeaveJamSessionAck { + optional bool error = 1; + optional string error_reason = 2; +} + +// target: session: +// sent by server to let the rest of the participants know a user has joined. +// this feels a little off; client could do this? *shrug* can change. +message UserJoinedJamSession { + optional string user_id = 1; // this is the user_id and can be used for user unicast messages + optional string username = 2; // meant to be a display name +} + +// target: client +// if you receive this, your connection will close after. +// but gives the client a chance to know why. +message ServerGenericError { + optional string error_msg = 1; } From ded8d6242568c74eece4b434fd743605bf42871a Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 20 Aug 2012 21:01:32 -0500 Subject: [PATCH 07/38] * c protocol buffers not required to build anymore --- build_protoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_protoc b/build_protoc index 47c2a6fd2..d115e8a3e 100755 --- a/build_protoc +++ b/build_protoc @@ -16,7 +16,7 @@ if [ -z $PROTOC] ; then PROTOC="protoc" fi -command -v $PROTOC >/dev/null 2>&1 || { echo >&2 "protoc is required but not installed. Aborting."; exit 1; } +command -v $PROTOC >/dev/null 2>&1 || { echo >&2 "protoc is required but not installed. Skipping c protocol buffers"; exit 0; } # die on error at this point set -e From 9a481a66917adc2d04cb7bf33e2b233cbdf12ede Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 20 Aug 2012 21:04:11 -0500 Subject: [PATCH 08/38] * had it backwards; now c is optional only --- build_protoc | 2 +- build_protoc-c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_protoc b/build_protoc index d115e8a3e..248406f32 100755 --- a/build_protoc +++ b/build_protoc @@ -16,7 +16,7 @@ if [ -z $PROTOC] ; then PROTOC="protoc" fi -command -v $PROTOC >/dev/null 2>&1 || { echo >&2 "protoc is required but not installed. Skipping c protocol buffers"; exit 0; } +command -v $PROTOC >/dev/null 2>&1 || { echo >&2 "protoc is required but not installed. Aborting"; exit 1; } # die on error at this point set -e diff --git a/build_protoc-c b/build_protoc-c index ab88764fe..05171eaea 100755 --- a/build_protoc-c +++ b/build_protoc-c @@ -14,7 +14,7 @@ if [ -z $PROTOCC] ; then fi # running protoc-c is currently optional -command -v $PROTOCC >/dev/null 2>&1 || { echo >&2 "protoc-c is required but not installed. Aborting."; exit 0; } +command -v $PROTOCC >/dev/null 2>&1 || { echo >&2 "protoc-c is required but not installed. Skipping c protocol buffers."; exit 0; } # die on error at this point set -e From d6daf16805e8ced5e11a6aa9b19e19fbb280fd6e Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 20 Aug 2012 21:10:12 -0500 Subject: [PATCH 09/38] * beefing up readme --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c4f049066..d9d531513 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ Jam-Pb (Protocol Buffers) Environment ----------- -* Download and install protoc 2.4.1 on the command-line: [Protocol Buffers Download](http://code.google.com/p/protobuf/downloads/list) -* Bash -* Optionally, if you have 'bundle' available (ruby dependency management tool), protocol buffers for ruby will also build. +* Download and install protoc 2.4.1 on your PATH: [Protocol Buffers Download](http://code.google.com/p/protobuf/downloads/list) +* Bash (on windows, [Git Bash[(http://code.google.com/p/msysgit/) was used successfully)] +* Optional: if you have 'bundle' available (ruby dependency management tool), protocol buffers for ruby will also build. +* Optional: if you have protoc-c on your PATH, protocol buffers for c will also build. Building -------- @@ -17,5 +18,10 @@ Using ----- ./target/cpp has cpp output ./target/ruby has ruby output +./target/c has c output +./target/java has java output -... this is a bit raw... could some day be better. But for now... +Contributing +------------ + +Edit src/client-container.proto to add or change existing messages. That file has more contextual information in it. From 2961564fbeb551cb7d147e6f1e14d93af3c1f966 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 20 Aug 2012 21:11:41 -0500 Subject: [PATCH 10/38] * making outputs a bulleted list --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d9d531513..d4bfb340f 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,12 @@ Building Using ----- -./target/cpp has cpp output -./target/ruby has ruby output -./target/c has c output -./target/java has java output +After a ./build: + +* ./target/cpp has cpp output +* ./target/ruby has ruby output +* ./target/c has c output +* ./target/java has java output Contributing ------------ From 559e95ab76112d4b2511a075ffc2838f19d68a27 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 26 Aug 2012 06:34:49 -0500 Subject: [PATCH 11/38] * discriminating unhandled server error from 'bad client' behavior. also addding Heartbeat --- src/client_container.proto | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index e4a3e0375..7ab8f7ede 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -16,8 +16,10 @@ message ClientMessage { USER_JOINED_JAM_SESSION = 104; LEAVE_JAM_SESSION = 105; LEAVE_JAM_SESSION_ACK = 106; + HEARTBEAT = 107; SERVER_GENERIC_ERROR = 1000; + SERVER_REJECTION_ERROR = 1001; } // Identifies which inner message is filled in @@ -26,19 +28,21 @@ message ClientMessage { // One of the following messages can be populated // Client-Server messages (to/from) - optional Login login = 100; // to server - optional LoginAck login_ack = 101; // from server - optional LoginJamSession login_jam_session = 102; // to server - optional LoginJamSessionAck login_jam_session_ack = 103; // from server - optional UserJoinedJamSession user_joined_jam_session = 104; // from server to all members - optional LeaveJamSession leave_jam_session = 105; - optional LeaveJamSessionAck leave_jam_session_ack = 106; + optional Login login = 100; // to server + optional LoginAck login_ack = 101; // from server + optional LoginJamSession login_jam_session = 102; // to server + optional LoginJamSessionAck login_jam_session_ack = 103; // from server + optional UserJoinedJamSession user_joined_jam_session = 104; // from server to all members + optional LeaveJamSession leave_jam_session = 105; + optional LeaveJamSessionAck leave_jam_session_ack = 106; + optional Heartbeat heartbeat = 107; // Client-Session messages (to/from) - // Server-to-Client errors + // Server-to-Client errors optional ServerGenericError server_generic_error = 1000; + optional ServerRejectionError server_rejection_error = 1001; } // target: server @@ -97,9 +101,24 @@ message UserJoinedJamSession { optional string username = 2; // meant to be a display name } +// target: server +// send from client to server periodically to know if session is gone +message Heartbeat { + +} + // target: client +// this indicates unhandled error on server // if you receive this, your connection will close after. // but gives the client a chance to know why. message ServerGenericError { optional string error_msg = 1; } + +// target: client +// this indicates the client did something wrong, and the server is mad enough to close connection. +// if you receive this, your connection will close after. +// but gives the client a chance to know why. +message ServerRejectionError { + optional string error_msg = 1; +} From b5bd730465c5d09d45d0e1216a342c44bbab6207 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 26 Aug 2012 14:34:32 -0500 Subject: [PATCH 12/38] * adding workspace var (although unused) --- Gemfile | 2 ++ src/client_container.proto | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index c5ba9b467..7f7d5888b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ source 'https://rubygems.org' +workspace = ENV["WORKSPACE"] || "~/workspace" + gem 'ruby-protocol-buffers', '1.2.2' diff --git a/src/client_container.proto b/src/client_container.proto index 7ab8f7ede..b8964016f 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -95,7 +95,7 @@ message LeaveJamSessionAck { // target: session: // sent by server to let the rest of the participants know a user has joined. -// this feels a little off; client could do this? *shrug* can change. +// this feels a little off; client could initiate this to other clients, right? message UserJoinedJamSession { optional string user_id = 1; // this is the user_id and can be used for user unicast messages optional string username = 2; // meant to be a display name From ecc46f95d5bb57916214b65850380cbb62b46098 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 26 Aug 2012 21:45:05 -0500 Subject: [PATCH 13/38] * adding TestSessionMessage, so that I can send a message intra-session --- src/client_container.proto | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index b8964016f..4c7ec8d36 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -18,15 +18,18 @@ message ClientMessage { LEAVE_JAM_SESSION_ACK = 106; HEARTBEAT = 107; - SERVER_GENERIC_ERROR = 1000; + TEST_SESSION_MESSAGE = 200; + + SERVER_GENERIC_ERROR = 1000; SERVER_REJECTION_ERROR = 1001; - } + } // Identifies which inner message is filled in required Type type = 1; required string target = 2; - // One of the following messages can be populated + // One of the following messages can be populated: + // Client-Server messages (to/from) optional Login login = 100; // to server optional LoginAck login_ack = 101; // from server @@ -37,8 +40,8 @@ message ClientMessage { optional LeaveJamSessionAck leave_jam_session_ack = 106; optional Heartbeat heartbeat = 107; - // Client-Session messages (to/from) - + // Client-Session messages (to/from) + optional TestSessionMessage test_session_message = 200; // Server-to-Client errors optional ServerGenericError server_generic_error = 1000; @@ -93,7 +96,7 @@ message LeaveJamSessionAck { optional string error_reason = 2; } -// target: session: +// target: client: // sent by server to let the rest of the participants know a user has joined. // this feels a little off; client could initiate this to other clients, right? message UserJoinedJamSession { @@ -101,6 +104,12 @@ message UserJoinedJamSession { optional string username = 2; // meant to be a display name } +// target: session +// a test message used by ruby-client currently. just gives way to send out to rest of session +message TestSessionMessage { + optional string msg = 1; +} + // target: server // send from client to server periodically to know if session is gone message Heartbeat { From a3058f0f70a61e3e9505a48997ecef97c023b798 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 3 Sep 2012 16:48:51 -0500 Subject: [PATCH 14/38] * slight update to docs --- src/client_container.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index 4c7ec8d36..c2775c784 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -2,7 +2,7 @@ // adding a new message: // within ClientMessage block, // create a new field in the enum Type section (100s are meant to be normal messages; 1000s are meant to be errors). It will have new field number X -// create a optional message of the same name, and use the same field number X. +// create a optional message of the same name (but lower-case! the json code requires this), and use the same field number X. // then at bottom of the file (or wherever; just outside any existing blocks), add your message definition. package jampb; @@ -16,11 +16,11 @@ message ClientMessage { USER_JOINED_JAM_SESSION = 104; LEAVE_JAM_SESSION = 105; LEAVE_JAM_SESSION_ACK = 106; - HEARTBEAT = 107; + HEARTBEAT = 107; - TEST_SESSION_MESSAGE = 200; + TEST_SESSION_MESSAGE = 200; - SERVER_GENERIC_ERROR = 1000; + SERVER_GENERIC_ERROR = 1000; SERVER_REJECTION_ERROR = 1001; } From e1aeb9ec4f6aa78faed96ee027457bd30957cdee Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 2 Oct 2012 00:51:49 -0400 Subject: [PATCH 15/38] added friend_update message --- src/client_container.proto | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index c2775c784..622e6dbfd 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -16,11 +16,12 @@ message ClientMessage { USER_JOINED_JAM_SESSION = 104; LEAVE_JAM_SESSION = 105; LEAVE_JAM_SESSION_ACK = 106; - HEARTBEAT = 107; + HEARTBEAT = 107; + FRIEND_UPDATE = 108; - TEST_SESSION_MESSAGE = 200; - - SERVER_GENERIC_ERROR = 1000; + TEST_SESSION_MESSAGE = 200; + + SERVER_GENERIC_ERROR = 1000; SERVER_REJECTION_ERROR = 1001; } @@ -31,17 +32,18 @@ message ClientMessage { // One of the following messages can be populated: // Client-Server messages (to/from) - optional Login login = 100; // to server - optional LoginAck login_ack = 101; // from server - optional LoginJamSession login_jam_session = 102; // to server - optional LoginJamSessionAck login_jam_session_ack = 103; // from server - optional UserJoinedJamSession user_joined_jam_session = 104; // from server to all members - optional LeaveJamSession leave_jam_session = 105; - optional LeaveJamSessionAck leave_jam_session_ack = 106; - optional Heartbeat heartbeat = 107; + optional Login login = 100; // to server + optional LoginAck login_ack = 101; // from server + optional LoginJamSession login_jam_session = 102; // to server + optional LoginJamSessionAck login_jam_session_ack = 103; // from server + optional UserJoinedJamSession user_joined_jam_session = 104; // from server to all members + optional LeaveJamSession leave_jam_session = 105; + optional LeaveJamSessionAck leave_jam_session_ack = 106; + optional Heartbeat heartbeat = 107; + optional FriendUpdate friend_update = 108 // from server to all friends of user // Client-Session messages (to/from) - optional TestSessionMessage test_session_message = 200; + optional TestSessionMessage test_session_message = 200; // Server-to-Client errors optional ServerGenericError server_generic_error = 1000; @@ -113,7 +115,14 @@ message TestSessionMessage { // target: server // send from client to server periodically to know if session is gone message Heartbeat { - + +} + +// target: client +// send from server to client when a user logs in +message FriendUpdate { + optional string user_id = 1; + optional bool online = 2; } // target: client From f480f0bf75e4f4f3d16e1edade8091bbbd2d3389 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 4 Oct 2012 21:33:32 -0500 Subject: [PATCH 16/38] * renamed all 'JamSession' occurrences to 'MusicSession' --- src/client_container.proto | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index c2775c784..ee07cb37a 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -11,11 +11,11 @@ message ClientMessage { enum Type { LOGIN = 100; LOGIN_ACK = 101; - LOGIN_JAM_SESSION = 102; - LOGIN_JAM_SESSION_ACK = 103; - USER_JOINED_JAM_SESSION = 104; - LEAVE_JAM_SESSION = 105; - LEAVE_JAM_SESSION_ACK = 106; + LOGIN_MUSIC_SESSION = 102; + LOGIN_MUSIC_SESSION_ACK = 103; + USER_JOINED_MUSIC_SESSION = 104; + LEAVE_MUSIC_SESSION = 105; + LEAVE_MUSIC_SESSION_ACK = 106; HEARTBEAT = 107; TEST_SESSION_MESSAGE = 200; @@ -33,11 +33,11 @@ message ClientMessage { // Client-Server messages (to/from) optional Login login = 100; // to server optional LoginAck login_ack = 101; // from server - optional LoginJamSession login_jam_session = 102; // to server - optional LoginJamSessionAck login_jam_session_ack = 103; // from server - optional UserJoinedJamSession user_joined_jam_session = 104; // from server to all members - optional LeaveJamSession leave_jam_session = 105; - optional LeaveJamSessionAck leave_jam_session_ack = 106; + optional LoginMusicSession login_music_session = 102; // to server + optional LoginMusicSessionAck login_music_session_ack = 103; // from server + optional UserJoinedMusicSession user_joined_music_session = 104; // from server to all members + optional LeaveMusicSession leave_music_session = 105; + optional LeaveMusicSessionAck leave_music_session_ack = 106; optional Heartbeat heartbeat = 107; // Client-Session messages (to/from) @@ -56,7 +56,7 @@ message ClientMessage { message Login { optional string username = 1; // username... could be email. need to wait for prod requirements optional string password = 2; // a password - optional string token = 3; // a token/cookie from previous successful login attempt or from 'token' field in .jam file + optional string token = 3; // a token/cookie from previous successful login attempt or from 'token' field in .music file } // target: client @@ -67,31 +67,31 @@ message LoginAck { } // target: server -// send from client to server to log in to a jam session and be 'present'. -// if successful, a LoginJamSessionAck is sent with error = false, and Client-Session messages will be passed -// directly from client to all other client. Also, the server will generate a 'UserJoinedJamSession' message +// send from client to server to log in to a music session and be 'present'. +// if successful, a LoginMusicSessionAck is sent with error = false, and Client-Session messages will be passed +// directly from client to all other client. Also, the server will generate a 'UserJoinedMusicSession' message // and send it to all other users to let the others know the user is here. -// if errored, a LoginJamSessionAck is sent with error = true. -message LoginJamSession { - optional string jam_session = 1; +// if errored, a LoginMusicSessionAck is sent with error = true. +message LoginMusicSession { + optional string music_session = 1; } // target: client -// error = true if the LoginJamSession command failed. -message LoginJamSessionAck { +// error = true if the LoginMusicSession command failed. +message LoginMusicSessionAck { optional bool error = 1; optional string error_reason = 2; } // target: server -// send from client to server to leave a previously joined jam session -message LeaveJamSession { - optional string jam_session = 1; +// send from client to server to leave a previously joined music session +message LeaveMusicSession { + optional string music_session = 1; } // target: client // error = true if the session didn't exist, but otherwise this is intended to always work barring server unrecoverable errors -message LeaveJamSessionAck { +message LeaveMusicSessionAck { optional bool error = 1; optional string error_reason = 2; } @@ -99,7 +99,7 @@ message LeaveJamSessionAck { // target: client: // sent by server to let the rest of the participants know a user has joined. // this feels a little off; client could initiate this to other clients, right? -message UserJoinedJamSession { +message UserJoinedMusicSession { optional string user_id = 1; // this is the user_id and can be used for user unicast messages optional string username = 2; // meant to be a display name } From 7b15816665025721edecfe4958db3810585d941d Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 7 Oct 2012 01:05:21 -0400 Subject: [PATCH 17/38] syntax error fix --- src/client_container.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client_container.proto b/src/client_container.proto index 622e6dbfd..924597431 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -40,7 +40,7 @@ message ClientMessage { optional LeaveJamSession leave_jam_session = 105; optional LeaveJamSessionAck leave_jam_session_ack = 106; optional Heartbeat heartbeat = 107; - optional FriendUpdate friend_update = 108 // from server to all friends of user + optional FriendUpdate friend_update = 108; // from server to all friends of user // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; From 43b51168bcdf0a15d7fc80157be3ee1d9a71f1c7 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 13 Oct 2012 17:47:10 -0500 Subject: [PATCH 18/38] * adding PingRequest, PingAck, and TestClientMessage (all p2p messages) --- src/client_container.proto | 74 +++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index ee07cb37a..7c14424a5 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -16,17 +16,25 @@ message ClientMessage { USER_JOINED_MUSIC_SESSION = 104; LEAVE_MUSIC_SESSION = 105; LEAVE_MUSIC_SESSION_ACK = 106; - HEARTBEAT = 107; + HEARTBEAT = 107; - TEST_SESSION_MESSAGE = 200; - - SERVER_GENERIC_ERROR = 1000; + TEST_SESSION_MESSAGE = 200; + + PING_REQUEST = 300; + PING_ACK = 301; + TEST_CLIENT_MESSAGE = 302; + + SERVER_GENERIC_ERROR = 1000; SERVER_REJECTION_ERROR = 1001; + SERVER_PERMISSION_ERROR = 1002; } // Identifies which inner message is filled in required Type type = 1; - required string target = 2; + required string route_to = 2; + optional string from = 3; + optional string message_id = 4; + optional string in_reply_to = 5; // One of the following messages can be populated: @@ -43,12 +51,18 @@ message ClientMessage { // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; + // Client-Client messages (to/from) + optional PingRequest ping_request = 300; + optional PingAck ping_ack = 301; + optional TestClientMessage test_client_message = 302; + // Server-to-Client errors optional ServerGenericError server_generic_error = 1000; optional ServerRejectionError server_rejection_error = 1001; + optional ServerPermissionError server_permission_error = 1002; } -// target: server +// route_to: server // sent from client to server to associate the connection with a user // either supply a username/password, or just supply token // if successful, a LoginAck is sent. @@ -57,16 +71,19 @@ message Login { optional string username = 1; // username... could be email. need to wait for prod requirements optional string password = 2; // a password optional string token = 3; // a token/cookie from previous successful login attempt or from 'token' field in .music file + optional string client_id = 4; // if supplied, the server will accept this client_id as the unique Id of this client instance } -// target: client +// route_to: client // sent from server to client to let the client know the login was successful, // and to also show the IP address of the client as seen by the server. message LoginAck { optional string public_ip = 1; + optional string client_id = 2; // a new client_id if none is supplied in Login, or just the original client_id echoed back + optional string token = 3; // the remember me token. This is useful if you logged in with username/password (otherwise it's just 'token' echoed back) } -// target: server +// route_to: server // send from client to server to log in to a music session and be 'present'. // if successful, a LoginMusicSessionAck is sent with error = false, and Client-Session messages will be passed // directly from client to all other client. Also, the server will generate a 'UserJoinedMusicSession' message @@ -76,27 +93,27 @@ message LoginMusicSession { optional string music_session = 1; } -// target: client +// route_to: client // error = true if the LoginMusicSession command failed. message LoginMusicSessionAck { optional bool error = 1; optional string error_reason = 2; } -// target: server +// route_to: server // send from client to server to leave a previously joined music session message LeaveMusicSession { optional string music_session = 1; } -// target: client +// route_to: client // error = true if the session didn't exist, but otherwise this is intended to always work barring server unrecoverable errors message LeaveMusicSessionAck { optional bool error = 1; optional string error_reason = 2; } -// target: client: +// route_to: client: // sent by server to let the rest of the participants know a user has joined. // this feels a little off; client could initiate this to other clients, right? message UserJoinedMusicSession { @@ -104,19 +121,37 @@ message UserJoinedMusicSession { optional string username = 2; // meant to be a display name } -// target: session +// route_to: session // a test message used by ruby-client currently. just gives way to send out to rest of session message TestSessionMessage { optional string msg = 1; } -// target: server +// route_to: client:[CLIENT_ID] +// asks a client to begin a ping session +message PingRequest { + +} + +// route_to: client:[CLIENT_ID] +// tells a client to begin pinging a session +message PingAck { + +} + +// route_to: client:[CLIENT_ID] +// a test message used by ruby-client currently. just gives a way to send directly to another client +message TestClientMessage { + optional string msg = 1; +} + +// route_to: server // send from client to server periodically to know if session is gone message Heartbeat { } -// target: client +// route_to: client // this indicates unhandled error on server // if you receive this, your connection will close after. // but gives the client a chance to know why. @@ -124,10 +159,17 @@ message ServerGenericError { optional string error_msg = 1; } -// target: client +// route_to: client // this indicates the client did something wrong, and the server is mad enough to close connection. // if you receive this, your connection will close after. // but gives the client a chance to know why. message ServerRejectionError { optional string error_msg = 1; } + +// route_to: client +// this indicates that the client doesn't have permission to ask the command +// your connection is not closed if this message occurs +message ServerPermissionError { + optional string error_msg = 1; +} From 019fe8fc36702d582aa537944cf12fa1c4520869 Mon Sep 17 00:00:00 2001 From: tihot_jk Date: Mon, 15 Oct 2012 02:13:22 -0700 Subject: [PATCH 19/38] Adding p2p message type. --- src/client_container.proto | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index 25a879003..e1bda7892 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -23,8 +23,9 @@ message ClientMessage { TEST_SESSION_MESSAGE = 200; PING_REQUEST = 300; - PING_ACK = 301; - TEST_CLIENT_MESSAGE = 302; + PING_ACK = 301; + PEER_MESSAGE = 302; + TEST_CLIENT_MESSAGE = 303; SERVER_GENERIC_ERROR = 1000; SERVER_REJECTION_ERROR = 1001; @@ -57,7 +58,8 @@ message ClientMessage { // Client-Client messages (to/from) optional PingRequest ping_request = 300; optional PingAck ping_ack = 301; - optional TestClientMessage test_client_message = 302; + optional PeerMessage peer_message = 302; + optional TestClientMessage test_client_message = 303; // Server-to-Client errors optional ServerGenericError server_generic_error = 1000; @@ -142,6 +144,12 @@ message PingAck { } +// route_to: client:[CLIENT_ID] +// generic message between clients +message PeerMessage { + optional string message = 1; +} + // route_to: client:[CLIENT_ID] // a test message used by ruby-client currently. just gives a way to send directly to another client message TestClientMessage { From d055d7212ebebfaf06f7070e3ca599234bcc1892 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 23 Oct 2012 06:34:30 -0500 Subject: [PATCH 20/38] * adding heartbeat interval to login_ack --- src/client_container.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client_container.proto b/src/client_container.proto index 25a879003..0062f4c11 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -84,6 +84,7 @@ message LoginAck { optional string public_ip = 1; optional string client_id = 2; // a new client_id if none is supplied in Login, or just the original client_id echoed back optional string token = 3; // the remember me token. This is useful if you logged in with username/password (otherwise it's just 'token' echoed back) + optional int32 heartbeat_interval = 4; // set your heartbeat interval to this value } // route_to: server From 568d9aedaed13f4020e6a408b9be435d4371211f Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 27 Oct 2012 17:26:24 -0500 Subject: [PATCH 21/38] * VRFS-27; adding notice that someone received an invitation --- src/client_container.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client_container.proto b/src/client_container.proto index 653a9ad31..29644c5df 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -19,6 +19,7 @@ message ClientMessage { LEAVE_MUSIC_SESSION_ACK = 106; HEARTBEAT = 107; FRIEND_UPDATE = 108; + SESSION_INVITATION = 109; TEST_SESSION_MESSAGE = 200; @@ -51,6 +52,7 @@ message ClientMessage { optional LeaveMusicSessionAck leave_music_session_ack = 106; optional Heartbeat heartbeat = 107; optional FriendUpdate friend_update = 108; // from server to all friends of user + optional SessionInvitation session_invitation = 109; // from server to user // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; @@ -170,6 +172,14 @@ message FriendUpdate { optional bool online = 2; } + +// route_to: user:[USER_ID] +// let a user know they've been invited to a session +message SessionInvitation { + optional string invitation = 1; +} + + // route_to: client // this indicates unhandled error on server // if you receive this, your connection will close after. From 8b2148990ff6ccd210957e01e5cb7909c60fb1af Mon Sep 17 00:00:00 2001 From: tihot_jk Date: Sun, 28 Oct 2012 17:27:44 -0700 Subject: [PATCH 22/38] Add session_id to the notifications when a client joins/leaves a music session. --- src/client_container.proto | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index 29644c5df..4e97f66ae 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -125,8 +125,9 @@ message LeaveMusicSessionAck { // sent by server to let the rest of the participants know a user has joined. // this feels a little off; client could initiate this to other clients, right? message UserJoinedMusicSession { - optional string user_id = 1; // this is the user_id and can be used for user unicast messages - optional string username = 2; // meant to be a display name + optional string session_id = 1; // the session ID + optional string user_id = 2; // this is the user_id and can be used for user unicast messages + optional string username = 3; // meant to be a display name } // route_to: session From 1ca1e4c884657f40220a96d7b7c6c43890cfa3e1 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 2 Nov 2012 02:47:54 -0500 Subject: [PATCH 23/38] * adding UserLeftMusicSession (to compliment UserJoinedMusicSession) --- src/client_container.proto | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/client_container.proto b/src/client_container.proto index 4e97f66ae..ed9e149f9 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -20,6 +20,7 @@ message ClientMessage { HEARTBEAT = 107; FRIEND_UPDATE = 108; SESSION_INVITATION = 109; + USER_LEFT_MUSIC_SESSION = 110; TEST_SESSION_MESSAGE = 200; @@ -53,6 +54,7 @@ message ClientMessage { optional Heartbeat heartbeat = 107; optional FriendUpdate friend_update = 108; // from server to all friends of user optional SessionInvitation session_invitation = 109; // from server to user + optional UserLeftMusicSession user_left_music_session = 110; // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; @@ -130,6 +132,17 @@ message UserJoinedMusicSession { optional string username = 3; // meant to be a display name } +// route_to: client: +// sent by server to let the rest of the participants know a user has joined. +// this feels a little off; client could initiate this to other clients, right? +message UserLeftMusicSession { + optional string session_id = 1; // the session ID + optional string user_id = 2; // this is the user_id and can be used for user unicast messages + optional string username = 3; // meant to be a display name +} + + + // route_to: session // a test message used by ruby-client currently. just gives way to send out to rest of session message TestSessionMessage { From dd31335e78fa1ed7fcc84124ffe799be0d2b4679 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 18 Nov 2012 00:03:00 -0600 Subject: [PATCH 24/38] * adding example jenkins to the mix --- Gemfile | 2 ++ jenkins | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 jenkins diff --git a/Gemfile b/Gemfile index 7f7d5888b..0f7889e6e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +#ruby=1.9.3 + source 'https://rubygems.org' workspace = ENV["WORKSPACE"] || "~/workspace" diff --git a/jenkins b/jenkins new file mode 100755 index 000000000..2d3bb662f --- /dev/null +++ b/jenkins @@ -0,0 +1,25 @@ +#!/bin/bash + +GEM_SERVER=http://localhost:9000/gems + +echo "starting build..." +./build + +if [ "$?" = "0" ]; then + echo "build succeeded" + echo "publishing gem" + pushd "target/ruby/jampb" + find . -name *.gem -exec curl -f -T {} $GEM_SERVER/{} \; + + if [ "$?" != "0" ]; then + echo "publish failed" + exit 1 + fi + popd + echo "done publishing gems" +else + echo "build failed" + exit 1 +fi + + From 45316d3e480467454eb185be63b54a5605bdeee4 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 18 Nov 2012 00:10:53 -0600 Subject: [PATCH 25/38] * updating jam-pb packaging to update ruby version --- package_ruby | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/package_ruby b/package_ruby index 5e39d1064..65731589b 100755 --- a/package_ruby +++ b/package_ruby @@ -10,8 +10,21 @@ bundle gem jampb > /dev/null # copy over built ruby code cp src/*.rb jampb/lib/jampb +if [ -z $BUILD_NUMBER ]; then + BUILD_NUMBER="1" +fi + +VERSION="0.0.${BUILD_NUMBER}" + pushd jampb > /dev/null +cat > lib/jampb/version.rb << EOF +module Jampb + VERSION = "$VERSION" +end +EOF + + # define gemspec cat >> jampb.gemspec << EOF From 35dc71b47a41f18df66ac6e55d2e588a759fab83 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 30 Nov 2012 09:23:13 -0600 Subject: [PATCH 26/38] * VRFS-98; notification created for join_request --- src/client_container.proto | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client_container.proto b/src/client_container.proto index ed9e149f9..c49390056 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -21,6 +21,7 @@ message ClientMessage { FRIEND_UPDATE = 108; SESSION_INVITATION = 109; USER_LEFT_MUSIC_SESSION = 110; + JOIN_REQUEST = 111; TEST_SESSION_MESSAGE = 200; @@ -55,6 +56,7 @@ message ClientMessage { optional FriendUpdate friend_update = 108; // from server to all friends of user optional SessionInvitation session_invitation = 109; // from server to user optional UserLeftMusicSession user_left_music_session = 110; + optional JoinRequest join_request = 111; // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; @@ -141,7 +143,11 @@ message UserLeftMusicSession { optional string username = 3; // meant to be a display name } - +message JoinRequest { + optional string join_request_id = 1; + optional string username = 2; + optional string text = 3; +} // route_to: session // a test message used by ruby-client currently. just gives way to send out to rest of session From 87f6c8ad0e2e6dc384f420170192395b4e2c1e79 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 6 Dec 2012 06:48:26 -0600 Subject: [PATCH 27/38] * p327 --- .rvmrc | 2 +- Gemfile | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.rvmrc b/.rvmrc index 5091144de..c1a6081c4 100644 --- a/.rvmrc +++ b/.rvmrc @@ -1 +1 @@ -rvm use ruby-1.9.3@jam-pb --create +rvm use ruby-1.9.3-p327@jam-pb --create diff --git a/Gemfile b/Gemfile index 0f7889e6e..7f7d5888b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,3 @@ -#ruby=1.9.3 - source 'https://rubygems.org' workspace = ENV["WORKSPACE"] || "~/workspace" From 2c0107f46a4fb1caf9f3df7f106d7a1297effdab Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Wed, 6 Feb 2013 07:08:15 -0600 Subject: [PATCH 28/38] added music_session_id to LoginAck --- src/client_container.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client_container.proto b/src/client_container.proto index c49390056..839b2c328 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -93,6 +93,7 @@ message LoginAck { optional string client_id = 2; // a new client_id if none is supplied in Login, or just the original client_id echoed back optional string token = 3; // the remember me token. This is useful if you logged in with username/password (otherwise it's just 'token' echoed back) optional int32 heartbeat_interval = 4; // set your heartbeat interval to this value + optional string music_session_id = 5; // users session id if present } // route_to: server From 50494c5fbd2e94088f7cc454f4dd15deb5e768be Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 23 Mar 2013 03:49:19 -0400 Subject: [PATCH 29/38] VRFS-281 added friend request messages --- src/client_container.proto | 67 ++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index 839b2c328..4d9cbe9dd 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -17,22 +17,24 @@ message ClientMessage { USER_JOINED_MUSIC_SESSION = 104; LEAVE_MUSIC_SESSION = 105; LEAVE_MUSIC_SESSION_ACK = 106; - HEARTBEAT = 107; + HEARTBEAT = 107; FRIEND_UPDATE = 108; SESSION_INVITATION = 109; USER_LEFT_MUSIC_SESSION = 110; JOIN_REQUEST = 111; + FRIEND_REQUEST = 112; + FRIEND_REQUEST_ACCEPTED = 113; - TEST_SESSION_MESSAGE = 200; + TEST_SESSION_MESSAGE = 200; - PING_REQUEST = 300; - PING_ACK = 301; - PEER_MESSAGE = 302; - TEST_CLIENT_MESSAGE = 303; + PING_REQUEST = 300; + PING_ACK = 301; + PEER_MESSAGE = 302; + TEST_CLIENT_MESSAGE = 303; SERVER_GENERIC_ERROR = 1000; SERVER_REJECTION_ERROR = 1001; - SERVER_PERMISSION_ERROR = 1002; + SERVER_PERMISSION_ERROR = 1002; } // Identifies which inner message is filled in @@ -45,27 +47,29 @@ message ClientMessage { // One of the following messages can be populated: // Client-Server messages (to/from) - optional Login login = 100; // to server - optional LoginAck login_ack = 101; // from server - optional LoginMusicSession login_music_session = 102; // to server - optional LoginMusicSessionAck login_music_session_ack = 103; // from server + optional Login login = 100; // to server + optional LoginAck login_ack = 101; // from server + optional LoginMusicSession login_music_session = 102; // to server + optional LoginMusicSessionAck login_music_session_ack = 103; // from server optional UserJoinedMusicSession user_joined_music_session = 104; // from server to all members - optional LeaveMusicSession leave_music_session = 105; - optional LeaveMusicSessionAck leave_music_session_ack = 106; - optional Heartbeat heartbeat = 107; - optional FriendUpdate friend_update = 108; // from server to all friends of user - optional SessionInvitation session_invitation = 109; // from server to user - optional UserLeftMusicSession user_left_music_session = 110; - optional JoinRequest join_request = 111; + optional LeaveMusicSession leave_music_session = 105; + optional LeaveMusicSessionAck leave_music_session_ack = 106; + optional Heartbeat heartbeat = 107; + optional FriendUpdate friend_update = 108; // from server to all friends of user + optional SessionInvitation session_invitation = 109; // from server to user + optional UserLeftMusicSession user_left_music_session = 110; + optional JoinRequest join_request = 111; + optional FriendRequest friend_request = 112; + optional FriendRequestAccepted friend_request_accepted = 113; // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; // Client-Client messages (to/from) - optional PingRequest ping_request = 300; - optional PingAck ping_ack = 301; + optional PingRequest ping_request = 300; + optional PingAck ping_ack = 301; optional PeerMessage peer_message = 302; - optional TestClientMessage test_client_message = 303; + optional TestClientMessage test_client_message = 303; // Server-to-Client errors optional ServerGenericError server_generic_error = 1000; @@ -159,7 +163,7 @@ message TestSessionMessage { // route_to: client:[CLIENT_ID] // asks a client to begin a ping session message PingRequest { - + } // route_to: client:[CLIENT_ID] @@ -186,6 +190,23 @@ message Heartbeat { } +// target: client +// send from server to client when user sends a friend request +message FriendRequest { + optional string user_id = 1; + optional string name = 2; + optional string photo_url = 3; + optional string friend_id = 4; +} + +// target: client +message FriendRequestAccepted { + optional string friend_id = 1; // accepter + optional string name = 2; + optional string photo_url = 3; + optional string user_id = 4; // original requester +} + // target: client // send from server to client when a user logs in message FriendUpdate { @@ -193,14 +214,12 @@ message FriendUpdate { optional bool online = 2; } - // route_to: user:[USER_ID] // let a user know they've been invited to a session message SessionInvitation { optional string invitation = 1; } - // route_to: client // this indicates unhandled error on server // if you receive this, your connection will close after. From 7d26ab8aab663cf37755c5c24d48662107489ed9 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 31 Mar 2013 14:07:25 -0400 Subject: [PATCH 30/38] VRFS-282 VRFS-283 toasts / notifications for friend updates and requests --- src/client_container.proto | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index 4d9cbe9dd..6b93de8b6 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -193,10 +193,12 @@ message Heartbeat { // target: client // send from server to client when user sends a friend request message FriendRequest { - optional string user_id = 1; - optional string name = 2; - optional string photo_url = 3; - optional string friend_id = 4; + optional string id = 1; + optional string user_id = 2; + optional string name = 3; + optional string photo_url = 4; + optional string friend_id = 5; + optional string msg = 6; } // target: client @@ -205,13 +207,17 @@ message FriendRequestAccepted { optional string name = 2; optional string photo_url = 3; optional string user_id = 4; // original requester + optional string msg = 5; } // target: client // send from server to client when a user logs in message FriendUpdate { optional string user_id = 1; - optional bool online = 2; + optional string name = 2; + optional string photo_url = 3; + optional bool online = 4; + optional string msg = 5; } // route_to: user:[USER_ID] From 4bc3ba3309fd80b16faddb7d79c682c5e599a8f6 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 4 Apr 2013 23:33:34 -0400 Subject: [PATCH 31/38] VRFS-282 changes to support real-time notification updates in sidebar --- src/client_container.proto | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client_container.proto b/src/client_container.proto index 6b93de8b6..72687fc93 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -199,6 +199,8 @@ message FriendRequest { optional string photo_url = 4; optional string friend_id = 5; optional string msg = 6; + optional string notification_id = 7; + optional string created_at = 8; } // target: client @@ -208,6 +210,8 @@ message FriendRequestAccepted { optional string photo_url = 3; optional string user_id = 4; // original requester optional string msg = 5; + optional string notification_id = 6; + optional string created_at = 7; } // target: client From 7b94ffae0ee766eec8e1332b44862780b78e2c34 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 13 Apr 2013 22:59:14 -0400 Subject: [PATCH 32/38] changes --- src/client_container.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client_container.proto b/src/client_container.proto index 72687fc93..a4826f20c 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -193,7 +193,7 @@ message Heartbeat { // target: client // send from server to client when user sends a friend request message FriendRequest { - optional string id = 1; + optional string friend_request_id = 1; optional string user_id = 2; optional string name = 3; optional string photo_url = 4; From 960116958905a7d62620a0186c9e0e0d4df96bed Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 30 May 2013 20:53:33 -0500 Subject: [PATCH 33/38] * switching to ruby 2.0.0 --- .ruby-gemset | 1 + .ruby-version | 1 + .rvmrc | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version delete mode 100644 .rvmrc diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 000000000..f6191d354 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +jam-pb diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..95a5ad2d5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.0.0-p195 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index c1a6081c4..000000000 --- a/.rvmrc +++ /dev/null @@ -1 +0,0 @@ -rvm use ruby-1.9.3-p327@jam-pb --create From a843004e502f4c8273a5c839ec37f60b58c2170f Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 25 Jun 2013 23:09:03 -0400 Subject: [PATCH 34/38] VRFS-107 session join / departure notifications --- src/client_container.proto | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/client_container.proto b/src/client_container.proto index a4826f20c..03890479b 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -14,16 +14,17 @@ message ClientMessage { LOGIN_MUSIC_SESSION = 102; LOGIN_MUSIC_SESSION_ACK = 103; - USER_JOINED_MUSIC_SESSION = 104; + FRIEND_SESSION_JOIN = 104; LEAVE_MUSIC_SESSION = 105; LEAVE_MUSIC_SESSION_ACK = 106; HEARTBEAT = 107; FRIEND_UPDATE = 108; SESSION_INVITATION = 109; - USER_LEFT_MUSIC_SESSION = 110; + MUSICIAN_SESSION_DEPART = 110; JOIN_REQUEST = 111; FRIEND_REQUEST = 112; FRIEND_REQUEST_ACCEPTED = 113; + MUSICIAN_SESSION_JOIN = 114; TEST_SESSION_MESSAGE = 200; @@ -51,16 +52,17 @@ message ClientMessage { optional LoginAck login_ack = 101; // from server optional LoginMusicSession login_music_session = 102; // to server optional LoginMusicSessionAck login_music_session_ack = 103; // from server - optional UserJoinedMusicSession user_joined_music_session = 104; // from server to all members + optional FriendSessionJoin friend_session_join = 104; // from server to all members optional LeaveMusicSession leave_music_session = 105; optional LeaveMusicSessionAck leave_music_session_ack = 106; optional Heartbeat heartbeat = 107; optional FriendUpdate friend_update = 108; // from server to all friends of user optional SessionInvitation session_invitation = 109; // from server to user - optional UserLeftMusicSession user_left_music_session = 110; + optional MusicianSessionDepart musician_session_depart = 110; optional JoinRequest join_request = 111; optional FriendRequest friend_request = 112; optional FriendRequestAccepted friend_request_accepted = 113; + optional MusicianSessionJoin musician_session_join = 114; // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; @@ -132,20 +134,29 @@ message LeaveMusicSessionAck { // route_to: client: // sent by server to let the rest of the participants know a user has joined. -// this feels a little off; client could initiate this to other clients, right? -message UserJoinedMusicSession { +message FriendSessionJoin { optional string session_id = 1; // the session ID optional string user_id = 2; // this is the user_id and can be used for user unicast messages optional string username = 3; // meant to be a display name + optional string photo_url = 4; } // route_to: client: // sent by server to let the rest of the participants know a user has joined. -// this feels a little off; client could initiate this to other clients, right? -message UserLeftMusicSession { +message MusicianSessionJoin { optional string session_id = 1; // the session ID optional string user_id = 2; // this is the user_id and can be used for user unicast messages optional string username = 3; // meant to be a display name + optional string photo_url = 4; +} + +// route_to: client: +// sent by server to let the rest of the participants know a user has left. +message MusicianSessionDepart { + optional string session_id = 1; // the session ID + optional string user_id = 2; // this is the user_id and can be used for user unicast messages + optional string username = 3; // meant to be a display name + optional string photo_url = 4; } message JoinRequest { From 6342d5d41f1f1927fbd7fc362228ec0278b9bcec Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 14 Jul 2013 21:45:20 -0500 Subject: [PATCH 35/38] * adding server down and server recovered messages for VRFS-196 --- src/client_container.proto | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/client_container.proto b/src/client_container.proto index 03890479b..2943c8ac5 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -33,9 +33,12 @@ message ClientMessage { PEER_MESSAGE = 302; TEST_CLIENT_MESSAGE = 303; + SERVER_BAD_STATE_RECOVERED = 900; + SERVER_GENERIC_ERROR = 1000; SERVER_REJECTION_ERROR = 1001; SERVER_PERMISSION_ERROR = 1002; + SERVER_BAD_STATE_ERROR = 1003; } // Identifies which inner message is filled in @@ -73,10 +76,14 @@ message ClientMessage { optional PeerMessage peer_message = 302; optional TestClientMessage test_client_message = 303; + // Server-to-Client special messages + optional ServerBadStateRecovered server_bad_state_recovered = 900; + // Server-to-Client errors optional ServerGenericError server_generic_error = 1000; optional ServerRejectionError server_rejection_error = 1001; optional ServerPermissionError server_permission_error = 1002; + optional ServerBadStateError server_bad_state_error = 1003; } // route_to: server @@ -241,6 +248,14 @@ message SessionInvitation { optional string invitation = 1; } +// route_to: client +// this should follow a ServerBadStateError in the case that the +// websocket gateway recovers from whatever ailed it +message ServerBadStateRecovered { +} + + + // route_to: client // this indicates unhandled error on server // if you receive this, your connection will close after. @@ -263,3 +278,12 @@ message ServerRejectionError { message ServerPermissionError { optional string error_msg = 1; } + +// route_to: client +// this indicates that the server is in a bad state, but could recover later, and is unable to process the request +// your connection is not closed if this message occurs +message ServerBadStateError { + optional string error_msg = 1; +} + + From d34f704cc5ceed3efb647c4d7ef25922e17c53e8 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 7 Aug 2013 10:38:08 -0500 Subject: [PATCH 36/38] * adding reconnect related messages to jam-pb --- src/client_container.proto | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/client_container.proto b/src/client_container.proto index 2943c8ac5..cc0f76f16 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -25,6 +25,8 @@ message ClientMessage { FRIEND_REQUEST = 112; FRIEND_REQUEST_ACCEPTED = 113; MUSICIAN_SESSION_JOIN = 114; + MUSICIAN_SESSION_FRESH = 115; + MUSICIAN_SESSION_STALE = 116; TEST_SESSION_MESSAGE = 200; @@ -66,6 +68,8 @@ message ClientMessage { optional FriendRequest friend_request = 112; optional FriendRequestAccepted friend_request_accepted = 113; optional MusicianSessionJoin musician_session_join = 114; + optional MusicianSessionFresh musician_session_fresh = 115; + optional MusicianSessionStale musician_session_stale = 116; // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; @@ -96,6 +100,8 @@ message Login { optional string password = 2; // a password optional string token = 3; // a token/cookie from previous successful login attempt or from 'token' field in .music file optional string client_id = 4; // if supplied, the server will accept this client_id as the unique Id of this client instance + optional string reconnect_music_session_id = 5; // if supplied, the server will attempt to log the client into this session (designed for reconnect scenarios while in-session) + } // route_to: client @@ -106,7 +112,8 @@ message LoginAck { optional string client_id = 2; // a new client_id if none is supplied in Login, or just the original client_id echoed back optional string token = 3; // the remember me token. This is useful if you logged in with username/password (otherwise it's just 'token' echoed back) optional int32 heartbeat_interval = 4; // set your heartbeat interval to this value - optional string music_session_id = 5; // users session id if present + optional string music_session_id = 5; // the music session that the user was in very recently (likely due to dropped connection) + optional bool reconnected = 6; // if reconnect_music_session_id is specified, and the server could log the user into that session, then true is returned. } // route_to: server @@ -166,6 +173,24 @@ message MusicianSessionDepart { optional string photo_url = 4; } +// route_to: client: +// sent by server to let the rest of the participants know a client has become active again after going stale +message MusicianSessionFresh { + optional string session_id = 1; // the session ID + optional string user_id = 2; // this is the user_id and can be used for user unicast messages + optional string username = 3; // meant to be a display name + optional string photo_url = 4; +} + +// route_to: client: +// sent by server to let the rest of the participants know a user has gone stale (websocket connection dropped) +message MusicianSessionStale { + optional string session_id = 1; // the session ID + optional string user_id = 2; // this is the user_id and can be used for user unicast messages + optional string username = 3; // meant to be a display name + optional string photo_url = 4; +} + message JoinRequest { optional string join_request_id = 1; optional string username = 2; From a75c5d450d96ef920b508a168f23deec56f8f00a Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 18 Aug 2013 02:57:00 +0000 Subject: [PATCH 37/38] * updating ruby version --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 95a5ad2d5..abf2ccea0 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.0.0-p195 +ruby-2.0.0-p247 From 89c750aaa29f7d61d4644e7efdf35b80d4f96b54 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 1 Sep 2013 02:16:26 +0000 Subject: [PATCH 38/38] * VRFS-594 - adding definition for heartbeat_ack --- src/client_container.proto | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client_container.proto b/src/client_container.proto index cc0f76f16..31c0fcad4 100644 --- a/src/client_container.proto +++ b/src/client_container.proto @@ -27,6 +27,7 @@ message ClientMessage { MUSICIAN_SESSION_JOIN = 114; MUSICIAN_SESSION_FRESH = 115; MUSICIAN_SESSION_STALE = 116; + HEARTBEAT_ACK = 117; TEST_SESSION_MESSAGE = 200; @@ -70,6 +71,7 @@ message ClientMessage { optional MusicianSessionJoin musician_session_join = 114; optional MusicianSessionFresh musician_session_fresh = 115; optional MusicianSessionStale musician_session_stale = 116; + optional HeartbeatAck heartbeat_ack = 117; // Client-Session messages (to/from) optional TestSessionMessage test_session_message = 200; @@ -228,11 +230,17 @@ message TestClientMessage { } // route_to: server -// send from client to server periodically to know if session is gone +// sent from client to server periodically to let server track if the client is truly alive and avoid TCP timeout scenarios +// the server will send a HeartbeatAck in response to this message Heartbeat { } +// target: client +// sent from server to client in response to a Heartbeat +message HeartbeatAck { +} + // target: client // send from server to client when user sends a friend request message FriendRequest {