Singyeong (singyeong v0.4.6) View Source
Helper functions to make a 신경 connection go!
Link to this section Summary
Functions
Parses a 신경 DSN into a format usable by the client. Returns a tuple of
{app_id, password | nil, host, port, scheme}
. Encoding is ignored, as this
client will always use ETF for communication.
Link to this section Functions
Specs
Parses a 신경 DSN into a format usable by the client. Returns a tuple of
{app_id, password | nil, host, port, scheme}
. Encoding is ignored, as this
client will always use ETF for communication.
Examples
iex> Singyeong.parse_dsn("singyeong://test@localhost")
{"test", nil, "localhost", 80, "ws"}
iex> Singyeong.parse_dsn("ssingyeong://test:pass-word@localhost")
{"test", "pass-word", "localhost", 80, "wss"}
iex> Singyeong.parse_dsn("singyeong://test@localhost:4567")
{"test", nil, "localhost", 4567, "ws"}
iex> Singyeong.parse_dsn("ssingyeong://test:pass~-word@localhost:4921/")
{"test", "pass~-word", "localhost", 4921, "wss"}
iex> Singyeong.parse_dsn("singyeong://test:pass@localhost:21312?encoding=json")
{"test", "pass", "localhost", 21312, "ws"}
iex> Singyeong.parse_dsn("ssingyeong://test:pass@host:12321/?encoding=etf")
{"test", "pass", "host", 12321, "wss"}
iex> Singyeong.parse_dsn("ssssssssingyeong://invalid:invalid@invalid:4567/?encoding=msgpack")
** (ArgumentError) dsn: invalid protocol: ssssssssingyeong