GithubHelp home page GithubHelp logo

jasononeil / haxe-nodejs-remoting-demo Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 2.0 454 KB

A working sample of Haxe Remoting from Browser JS to Server NodeJS

Shell 0.01% JavaScript 16.22% Python 2.13% Haxe 81.63%

haxe-nodejs-remoting-demo's Introduction

Haxenode-Remoting

This repo is an example of Haxe Remoting working between NodeJS Server and JS Browser client.

Building / Running

You will need the NodeJS "connect" module installed. To install, run

npm install connect 			

Run these commands:

haxe client.hxml 				# Compile the client
haxe server.hxml 				# Compile the server
node out/node.js 				# Run the server

Or have them all as one line:

haxe client.hxml; haxe server.hxml; node out/node.js

Then visit http://localhost:8000/ in your browser, and open the console/firebug.

What this shows

  • The 'remoting' haxelib does work, or at least, it would if it were running the latest version on github.
  • That you can have a NodeJS server and a JS client, both with haxe, sharing code and using remoting to pass objects back and forth and call functions.

Why did I bother?

  • I couldn't get the 'remoting' haxelib to work
  • The examples seemed confusing, and the haxelibs were out of date (not the author's fault - he hasn't been able to update)
  • I was determined to make it work, and needed a blank slate to test / debug.
  • Example code of this working will be useful not only for me, but for many interested in using haxe to target NodeJS.
  • If I comment it really well, I'll hopefully understand NodeJS alot better.

Using in your own project

Until Dion is able to update haxelib (it's not cooperating), this will only work with a more recent version from Git. Rather than using "haxelib install ...", we'll use git submodules. If you don't use git, you might have to download my repo and copy / paste.

If you do use GIT, these commands will add the submodules for you:

git submodule add https://github.com/dionjwa/nodejs_externs.git lib/nodejs_externs
git submodule add https://github.com/cloudshift/hx-node.git lib/hx-node
git submodule add https://github.com/dionjwa/haxe_remoting.git lib/haxe_remoting
git submodule add https://github.com/dionjwa/transition9.git lib/transition9

haxe-nodejs-remoting-demo's People

Contributors

jasononeil avatar

Stargazers

The Algebraist avatar Michael Neuhaus avatar jexm avatar TiagoLr avatar Adam Harte avatar Matthijs Kamstra avatar Eugene Veretennikov avatar  avatar  avatar Marcelo Serpa avatar

Watchers

 avatar Mr zhan avatar James Cloos avatar zeroify avatar  avatar

Forkers

swetq tiagolr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.