Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C# REPL scripts to Communitcate with Firebase
Action<string,string,string,string> sendData_Raw =
(app,token, area, data)=>
{
ThreadPool.QueueUserWorkItem((o)=>
{
var url = "https://{0}.firebaseio.com/{1}.json?auth={2}".format(app, area, token);
var now = DateTime.Now.ToShortTimeString(); // DateTime.Now. TimeOfDay;
var postData = "\"{0}: {1}\"".format(now, data.replace("\"", "'"));
url.POST(postData);
});
};
Action<string,string> sendData =
(area, data) => {
var app = "tm-admin-test";
var authToken = "11uXXuQHpzhrG2LzV1DNu17tOBu0psTqR6bNhFZm";
sendData_Raw(app, authToken, area, data);
};
Action<string> logDebugMsg =
(message)=>{
sendData("debugMsg", message);
};
Action<string> logRequestURL =
(url)=>{
sendData("requestUrl", url);
};
if (TMEvents.OnApplication_BeginRequest.size() > 1)
TMEvents.OnApplication_BeginRequest.remove(1);
logDebugMsg("mapping TMEvents.OnApplication_BeginRequest to send url to Firebase");
TMEvents.OnApplication_BeginRequest.Add(
()=>{
logRequestURL(HttpContextFactory.Request.Url.str());
});
return TMEvents.OnApplication_BeginRequest.size();
//using System.Threading;
//using TeamMentor.CoreLib;
//O2Ref:TeamMentor.CoreLib.dll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.