github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/outputs/socket.md (about) 1 --- 2 title: socket 3 type: output 4 status: stable 5 categories: ["Network"] 6 --- 7 8 <!-- 9 THIS FILE IS AUTOGENERATED! 10 11 To make changes please edit the contents of: 12 lib/output/socket.go 13 --> 14 15 import Tabs from '@theme/Tabs'; 16 import TabItem from '@theme/TabItem'; 17 18 19 Connects to a (tcp/udp/unix) server and sends a continuous stream of data, dividing messages according to the specified codec. 20 21 ```yaml 22 # Config fields, showing default values 23 output: 24 label: "" 25 socket: 26 network: unix 27 address: /tmp/benthos.sock 28 codec: lines 29 ``` 30 31 ## Batches and Multipart Messages 32 33 When writing multipart (batched) messages using the `lines` codec the last message ends with double delimiters. E.g. the messages "foo", "bar" and "baz" would be written as: 34 35 ``` 36 foo\n 37 bar\n 38 baz\n 39 ``` 40 41 Whereas a multipart message [ "foo", "bar", "baz" ] would be written as: 42 43 ``` 44 foo\n 45 bar\n 46 baz\n\n 47 ``` 48 49 This enables consumers of this output feed to reconstruct the original batches. However, if you wish to avoid this behaviour then add a [`split` processor](/docs/components/processors/split) before messages reach this output. 50 51 ## Fields 52 53 ### `network` 54 55 The network type to connect as. 56 57 58 Type: `string` 59 Default: `"unix"` 60 Options: `unix`, `tcp`, `udp`. 61 62 ### `address` 63 64 The address (or path) to connect to. 65 66 67 Type: `string` 68 Default: `"/tmp/benthos.sock"` 69 70 ```yaml 71 # Examples 72 73 address: /tmp/benthos.sock 74 75 address: localhost:9000 76 ``` 77 78 ### `codec` 79 80 The way in which the bytes of messages should be written out into the output data stream. It's possible to write lines using a custom delimiter with the `delim:x` codec, where x is the character sequence custom delimiter. 81 82 83 Type: `string` 84 Default: `"lines"` 85 86 | Option | Summary | 87 |---|---| 88 | `all-bytes` | Only applicable to file based outputs. Writes each message to a file in full, if the file already exists the old content is deleted. | 89 | `append` | Append each message to the output stream without any delimiter or special encoding. | 90 | `lines` | Append each message to the output stream followed by a line break. | 91 | `delim:x` | Append each message to the output stream followed by a custom delimiter. | 92 93 94 ```yaml 95 # Examples 96 97 codec: lines 98 99 codec: "delim:\t" 100 101 codec: delim:foobar 102 ``` 103 104