Crossplatform implementation of 'Google's Protocol Buffers' for haxe.

To install, run:

haxelib install protohx 0.4.6 

See using Haxelib in Haxelib documentation for more information.

Protohx is crossplatform implementation of "Google's Protocol Buffers" for haxe 3.

This is partial port of ActionScript3 protoc plugin "protoc-gen-as3" for haxe. Currently implemented only basic functionality: read/write messages from/to

haxe 3 compatible. Core functionality doesn't depend on third-party libraries.



See also

* - Official Google Protocol Buffers page
* - another haxe implementation from original "protoc-gen-as3" author 
* - ActionScript 3 protoc plugin
* - another haxe implementation (GPL)

Supported Features

This functionality ported from "protoc-gen-as3"

* All basic types  (int, int64, string, bytes, bool)
* Nested messages
* Enumerations (as integer)
* Packed and non-packed repeated fields
* Extensions (converted to optional fields)

Tested targets

* flash
* neko 2.0
* cpp (linux32, win32, android)
* js
* php
* java
* as3

System requirements

* haxe 3.1.3
* neko 2.0
* protoc 2.5.0
* java 1.7
* ant (for build plugin from sources)

How to install

1) install protohx
     $ haxelib install protohx
     $ haxelib hg protohx
     $ haxelib git protohx
2) install protoc into system PATH
   * Windows: 
       Unpack and add protoc.exe location to system %PATH%
   * Ubuntu:
       $ sudo aptitude install protobuf-compiler
   * Other:
       Download source code from
       Unpack and make && make install.
   * NOTE:
       You also can set custom protoc executable with "setup-protoc"
           $ haxelib run protohx setup-protoc PROTOC_2_5_0_PATH 
       For example:
           $ haxelib run protohx setup-protoc /home/user/opt/protobuf-2.5.0/src/protoc

How to use

1) create empty json config file in project directory with "config"
    $ haxelib run protohx config protohx.json
    Change and save protohx.json 
    // File: samples/test-core/protohx.json
        "protoPath": "proto",
        "protoFiles": [
        "cleanOut": true,
        "haxeOut": "out/src-gen",
        "javaOut": null
        protoPath - base path for import directive in proto files;
        protoFiles - list of files for code generation;
        haxeOut/javaOut - path for generated sources (add it in project classpath);
        cleanOut - if 'true' clean output directories before code generation.

2) write proto files
3) genearate haxe sources:
      $ haxelib run protohx generate protohx.json
4) add "out/src-gen" (see param: haxeOut) directory in project classpath


Protohx project urls: 

This project consists from follow parts:
    * tools/plugin - protoc plugin for generating haxe sources;
    * tools/run - haxelib runner. Generate haxe and a java sources by json config in project directory;
    * protohx - library sources. Pure-haxe port of main parts originally ActionScrip3 code from protoc-gen-as3;
    * samples/01-core - unit tests;
    * samples/02-ipc - java-to-neko and neko-to-java intercommunication test.
        NOTE: Install protoc 2.5.0 via "haxelib run protohx setup-protoc PROTOC_2_5_0_PATH" before building java part of this test.
    * samples/03-network - complete client-server example.
       build/run node.js server:
            haxe build-server-js.hxml
       or neko serer:
            haxe build-server-neko.hxml
       and build/run flash client:
            haxe build-client-flash.hxml
            nme test (flash|linux|android)
2 years ago

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser!

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github