Skip to content
Example of an TCP service which uses hooks.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
service
.gitignore
.gitmodules
README.md
build.gradle
settings.gradle

README.md

This service shows you how hooks work in sweetp with a TCP service. You need both services pub and sub to test it with sweetp. Put the jar files in your "server/services-tcp" folder and add this to your "server/services.json" file:

{
	"id":"pub",
	"exec":[
		"java",
		"-jar",
		"testpub-groovy-tcp-0.1.jar"
	],
	"dir":"services-tcp/"
},
{
	"id":"sub",
	"exec":[
		"java",
		"-jar",
		"testsub-groovy-tcp-0.1.jar"
	],
	"dir":"services-tcp/"
},

After the server started you can test it with this command:

sweetp -p none tests service testpub sayhello

and get following output:

pre hook returned text -> original text was: nothing yet
post hook returned text -> original text was: sayhello
original text -> sayhello

The service uses a base class for TCP communication, look at that project for more information about TCP services. Since groovy lives in the JVM it is recommended to build a jvm service.

For basic information see boilerplate service.

More Information on sweet productivity.

You can’t perform that action at this time.