# Using custom serializer

From v5.0 version there is option to provide custom serializer.

Custom serializer instance must meet a few requirements:

* Have a `encode (data)` method, that returns encoded data
* Have a `decode (data)` method, that returns decoded data
* Have a `protocol` string property, that contains a protocol name. This name is concatenated with "wamp.2." string and is then passed as websocket subprotocol http header.
* Have a `isBinary` boolean property, that indicates, is this a binary protocol or not.

Take a look at JsonSerializer.js or MsgpackSerializer.js as examples.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ksdaemon.gitbook.io/wampy.js/using-custom-serializer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
