You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Lua client for Nakama server written in Lua 5.1.
7
7
@@ -292,49 +292,68 @@ end)
292
292
Messages initiated _by the server_ in an authoritative match will come as valid JSON by default.
293
293
294
294
295
-
## Adapting to other engines
295
+
# Satori
296
+
297
+
> Lua client for Satori written in Lua 5.1.
298
+
299
+
[Satori](https://heroiclabs.com/satori/) is a liveops server for games that powers actionable analytics, A/B testing and remote configuration. Use the Satori Defold client to communicate with Satori from within your Defold game.
300
+
301
+
## Getting started
302
+
303
+
Create a Satori client using the API key from the Satori dashboard.
296
304
297
-
Adapting the Nakama Defold client to another Lua based engine should be as easy as providing another engine module when configuring the Nakama client:
298
305
299
306
```lua
300
-
localmyengine=require"nakama.engine.myengine"
301
-
localnakama=require"nakama.nakama"
302
-
localconfig= {
303
-
engine=myengine,
304
-
}
305
-
localclient=nakama.create_client(config)
307
+
localconfig= {
308
+
host="myhost.com",
309
+
api_key="my-api-key",
310
+
use_ssl=true,
311
+
port=443,
312
+
retry_policy=retries.incremental(5, 1),
313
+
engine=defold,
314
+
}
315
+
localclient=satori.create_client(config)
306
316
```
307
317
308
-
The engine module must provide the following functions:
*`socket` - Socket instance returned from `socket_create()`
325
-
*`callback` - Function to call with result (ok, err)
334
+
```lua
335
+
satori.sync(function()
336
+
localexperiments=satori.get_experiments(client)
337
+
pprint(experiments)
326
338
327
-
*`socket_send(socket, message, callback)` - Send message on socket.
328
-
*`socket` - Socket instance returned from `socket_create()`
329
-
*`message` - Message to send
330
-
*`callback` - Function to call with message returned as a response (message)
339
+
localflags=satori.get_flags(client)
340
+
pprint(flags)
341
+
end)
342
+
```
331
343
332
-
*`uuid()` - Create a UUID
333
344
345
+
# Contribute
346
+
347
+
The development roadmap is managed as GitHub issues and pull requests are welcome. If you're interested to enhance the code please open an issue to discuss the changes or drop in and discuss it in the [community forum](https://forum.heroiclabs.com).
334
348
335
-
## API codegen
336
349
337
-
Refer to instructions in `codegen`.
350
+
## Run tests
351
+
352
+
Unit tests can be found in the `tests` folder. Run them using [Telescope](https://github.com/defold/telescope) (fork which supports Lua 5.3+):
Unit tests can be found in the `tests` folder. Run them using [Telescope](https://github.com/defold/telescope) (fork which supports Lua 5.3+):
364
381
382
+
## Generate code
383
+
384
+
Refer to instructions in the [codegen folder](/codegen).
385
+
386
+
387
+
## Adapting to other engines
388
+
389
+
Adapting the Nakama and Satori Defold clients to another Lua based engine should be as easy as providing another engine module when configuring the Nakama client:
*`config` - Config table passed to `nakama.create()` or `satori.create()`
413
+
*`url_path` - Path to append to the base uri
414
+
*`query_params` - Key-value pairs to use as URL query parameters
415
+
*`method` - "GET", "POST"
416
+
*`post_data` - Data to post
417
+
*`cancellation_token` - Check if `cancellation_token.cancelled` is true
418
+
*`callback` - Function to call with result (response)
370
419
371
-
The development roadmap is managed as GitHub issues and pull requests are welcome. If you're interested to enhance the code please open an issue to discuss the changes or drop in and discuss it in the [community forum](https://forum.heroiclabs.com).
420
+
*`socket_create(config, on_message)` - Create socket. Must return socket instance (table with engine specific socket state).
421
+
*`config` - Config table passed to `nakama.create()` or `satori.create()
422
+
*`on_message` - Function to call when a message is sent from the server
Generates Lua code from the Nakama swagger definition in the main Nakama repository and the Nakama RealTime protobuf definition in the Nakama-Common repository.
1
+
Generates Lua code from the Nakama and Satori API definitions (swagger and protobuf).
2
2
3
3
## Usage
4
4
5
-
Generate the REST API:
5
+
Generate Lua bindings for the Nakama and Satori REST APIs and the Nakama realtime API:
6
6
7
7
```shell
8
-
go run rest.go /path/to/nakama/apigrpc/apigrpc.swagger.json > ../nakama/nakama.lua
0 commit comments