-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
26 lines (17 loc) · 1.15 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Auto complete client is an erlang client lib to communicate with auto complete server.
the client lib runs in an erlang process, it is up to calling process to monitor the healthiness of this process.
There are two methods to start the client lib
1. initClient(ServerName, Port, Pid) which auto spawns out a process for the client lib, a spawned process id is returned
for example autocomplete_clt:initClient(localhost, 5050, self())
2. start(ServerName, Port, Pid)
the usage is to call via spawn or spawn_link, for example spawn(autocomplete_clt, start, [localhost, 5050, self()])
After client started, calling process can pass 3 types of messages
Add: for example {add, "gye", "gye@tigertext.com", "request1"}
Remove: for example {remove, "gye", "request1"}
Search: for example {search, "gye", "request2"}
On Search request, the calling process is expect to receive response in format of {search, RequestId, ResultList}
for example: {search, req3, [<<"gye@tigertext.com">>]}.
Since all the operation is asynchronous, it is upto the calling process to setup a timer while waiting for response of search request.
To compile:
make
More usage example, please see test.erl.